KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > tools > specifier > dialogs > ImportOptionsDialog


1 package com.genimen.djeneric.tools.specifier.dialogs;
2
3 import java.awt.BorderLayout JavaDoc;
4 import java.awt.Dimension JavaDoc;
5 import java.awt.Frame JavaDoc;
6 import java.awt.Toolkit JavaDoc;
7 import java.awt.event.ActionEvent JavaDoc;
8 import java.awt.event.ActionListener JavaDoc;
9
10 import javax.swing.ButtonGroup JavaDoc;
11 import javax.swing.JButton JavaDoc;
12 import javax.swing.JCheckBox JavaDoc;
13 import javax.swing.JDialog JavaDoc;
14 import javax.swing.JLabel JavaDoc;
15 import javax.swing.JPanel JavaDoc;
16
17 import com.genimen.djeneric.language.Messages;
18 import com.genimen.djeneric.ui.DjVerticalFlowLayout;
19 import com.genimen.djeneric.ui.Util;
20 import com.genimen.djeneric.util.DjLogger;
21
22 public class ImportOptionsDialog extends JDialog JavaDoc
23 {
24   private static final long serialVersionUID = 1L;
25   JPanel JavaDoc panel1 = new JPanel JavaDoc();
26   BorderLayout JavaDoc borderLayout1 = new BorderLayout JavaDoc();
27   JPanel JavaDoc jPanel1 = new JPanel JavaDoc();
28   BorderLayout JavaDoc borderLayout2 = new BorderLayout JavaDoc();
29   JPanel JavaDoc jPanel2 = new JPanel JavaDoc();
30   JButton JavaDoc _butOk = new JButton JavaDoc();
31   JButton JavaDoc _butCancel = new JButton JavaDoc();
32   JPanel JavaDoc jPanel3 = new JPanel JavaDoc();
33   JPanel JavaDoc jPanel4 = new JPanel JavaDoc();
34   DjVerticalFlowLayout flowLayout1 = new DjVerticalFlowLayout();
35   DjVerticalFlowLayout flowLayout2 = new DjVerticalFlowLayout();
36   ButtonGroup JavaDoc _grpSelection = new ButtonGroup JavaDoc();
37   boolean _wasCanceled = true;
38   JLabel JavaDoc _lblMerge = new JLabel JavaDoc();
39   JCheckBox JavaDoc _chkMerge = new JCheckBox JavaDoc();
40
41   public ImportOptionsDialog(Frame JavaDoc owner)
42   {
43     super(owner, Messages.getString("ImportDialog.Options"), true);
44     try
45     {
46       setDefaultCloseOperation(DISPOSE_ON_CLOSE);
47       jbInit();
48       pack();
49       Dimension JavaDoc screenSize = Toolkit.getDefaultToolkit().getScreenSize();
50       Dimension JavaDoc frameSize = getSize();
51       setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
52       setVisible(true);
53
54     }
55     catch (Exception JavaDoc x)
56     {
57       DjLogger.log(x);
58     }
59   }
60
61   public boolean wasCanceled()
62   {
63     return _wasCanceled;
64   }
65
66   public ImportOptionsDialog()
67   {
68     this(new Frame JavaDoc());
69   }
70
71   private void jbInit() throws Exception JavaDoc
72   {
73     panel1.setLayout(borderLayout1);
74     jPanel1.setLayout(borderLayout2);
75     _butOk.setText(Messages.getString("global.Ok"));
76     _butOk.addActionListener(new ImportOptionsDlg__butOk_actionAdapter(this));
77     _butCancel.setText(Messages.getString("global.Cancel"));
78     _butCancel.addActionListener(new ImportOptionsDlg__butCancel_actionAdapter(this));
79     jPanel3.setLayout(flowLayout1);
80     jPanel4.setLayout(flowLayout2);
81     _lblMerge.setText(Messages.getString("ImportDialog.MergeDetails"));
82     _chkMerge.setText("");
83     _chkMerge.setSelected(true);
84     getContentPane().add(panel1);
85     panel1.add(jPanel1, java.awt.BorderLayout.SOUTH);
86     jPanel1.add(jPanel2, java.awt.BorderLayout.EAST);
87     jPanel2.add(_butCancel);
88     jPanel2.add(_butOk);
89     panel1.add(jPanel3, java.awt.BorderLayout.WEST);
90     jPanel3.add(_lblMerge, null);
91     panel1.add(jPanel4, java.awt.BorderLayout.CENTER);
92     jPanel4.add(_chkMerge, null);
93     Util.sizeButtons(jPanel2);
94     Util.sizeLabels(jPanel3);
95     Util.sizeLabels(jPanel4);
96   }
97
98   public boolean shouldMerge()
99   {
100     return _chkMerge.isSelected();
101   }
102
103   public void _butOk_actionPerformed(ActionEvent JavaDoc e)
104   {
105     _wasCanceled = false;
106     setVisible(false);
107   }
108
109   public void _butCancel_actionPerformed(ActionEvent JavaDoc e)
110   {
111     setVisible(false);
112   }
113
114   class ImportOptionsDlg__butCancel_actionAdapter implements ActionListener JavaDoc
115   {
116     private ImportOptionsDialog adaptee;
117
118     ImportOptionsDlg__butCancel_actionAdapter(ImportOptionsDialog adaptee)
119     {
120       this.adaptee = adaptee;
121     }
122
123     public void actionPerformed(ActionEvent JavaDoc e)
124     {
125       adaptee._butCancel_actionPerformed(e);
126     }
127   }
128
129   class ImportOptionsDlg__butOk_actionAdapter implements ActionListener JavaDoc
130   {
131     private ImportOptionsDialog adaptee;
132
133     ImportOptionsDlg__butOk_actionAdapter(ImportOptionsDialog adaptee)
134     {
135       this.adaptee = adaptee;
136     }
137
138     public void actionPerformed(ActionEvent JavaDoc e)
139     {
140       adaptee._butOk_actionPerformed(e);
141     }
142   }
143 }
Popular Tags