2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2004, The Institute for Genomic Research (TIGR). |
2 |
26 Feb 07 |
jari |
All rights reserved. |
2 |
26 Feb 07 |
jari |
4 |
*/ |
2 |
26 Feb 07 |
jari |
5 |
/* |
2 |
26 Feb 07 |
jari |
* $RCSfile: FOMInitDialog.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.6 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/02/23 20:59:51 $ |
2 |
26 Feb 07 |
jari |
* $Author: caliente $ |
2 |
26 Feb 07 |
jari |
* $State: Exp $ |
2 |
26 Feb 07 |
jari |
11 |
*/ |
2 |
26 Feb 07 |
jari |
12 |
package org.tigr.microarray.mev.cluster.gui.impl.fom; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
/** |
2 |
26 Feb 07 |
jari |
15 |
* |
2 |
26 Feb 07 |
jari |
* @author nbhagaba |
2 |
26 Feb 07 |
jari |
* @version |
2 |
26 Feb 07 |
jari |
18 |
*/ |
2 |
26 Feb 07 |
jari |
19 |
|
2 |
26 Feb 07 |
jari |
20 |
import java.awt.Color; |
2 |
26 Feb 07 |
jari |
21 |
import java.awt.Dimension; |
2 |
26 Feb 07 |
jari |
22 |
import java.awt.Font; |
2 |
26 Feb 07 |
jari |
23 |
import java.awt.GridBagConstraints; |
2 |
26 Feb 07 |
jari |
24 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
25 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
26 |
import java.awt.Toolkit; |
2 |
26 Feb 07 |
jari |
27 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
28 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
29 |
import java.awt.event.WindowAdapter; |
2 |
26 Feb 07 |
jari |
30 |
|
2 |
26 Feb 07 |
jari |
31 |
import javax.swing.BorderFactory; |
2 |
26 Feb 07 |
jari |
32 |
import javax.swing.ButtonGroup; |
2 |
26 Feb 07 |
jari |
33 |
import javax.swing.JCheckBox; |
2 |
26 Feb 07 |
jari |
34 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
35 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
36 |
import javax.swing.JOptionPane; |
2 |
26 Feb 07 |
jari |
37 |
import javax.swing.JPanel; |
2 |
26 Feb 07 |
jari |
38 |
import javax.swing.JRadioButton; |
2 |
26 Feb 07 |
jari |
39 |
import javax.swing.JTabbedPane; |
2 |
26 Feb 07 |
jari |
40 |
import javax.swing.JTextField; |
2 |
26 Feb 07 |
jari |
41 |
import javax.swing.UIManager; |
2 |
26 Feb 07 |
jari |
42 |
import javax.swing.border.EtchedBorder; |
2 |
26 Feb 07 |
jari |
43 |
import javax.swing.border.TitledBorder; |
2 |
26 Feb 07 |
jari |
44 |
import javax.swing.event.ChangeListener; |
2 |
26 Feb 07 |
jari |
45 |
|
2 |
26 Feb 07 |
jari |
46 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.AlgorithmDialog; |
2 |
26 Feb 07 |
jari |
47 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.ParameterPanel; |
2 |
26 Feb 07 |
jari |
48 |
import org.tigr.microarray.mev.cluster.gui.impl.dialogs.dialogHelpUtil.HelpWindow; |
2 |
26 Feb 07 |
jari |
49 |
|
2 |
26 Feb 07 |
jari |
50 |
public class FOMInitDialog extends AlgorithmDialog { |
2 |
26 Feb 07 |
jari |
51 |
|
2 |
26 Feb 07 |
jari |
52 |
public final static int CAST = 1; |
2 |
26 Feb 07 |
jari |
53 |
public final static int KMEANS = 2; |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
55 |
IterationPanel iPanel; |
2 |
26 Feb 07 |
jari |
56 |
KMCPanel kPanel; |
2 |
26 Feb 07 |
jari |
57 |
CASTPanel cPanel; |
2 |
26 Feb 07 |
jari |
58 |
JTabbedPane methodTabPane; |
2 |
26 Feb 07 |
jari |
59 |
JCheckBox takeAverageBox; |
2 |
26 Feb 07 |
jari |
60 |
SampleSelectionPanel sPanel; |
2 |
26 Feb 07 |
jari |
61 |
|
2 |
26 Feb 07 |
jari |
62 |
boolean okPressed = false; |
2 |
26 Feb 07 |
jari |
/** Creates new FOMInitDialog */ |
2 |
26 Feb 07 |
jari |
64 |
public FOMInitDialog(JFrame parentFrame, boolean modality) { |
2 |
26 Feb 07 |
jari |
65 |
super(parentFrame, "FOM: Figure of Merit", modality); |
2 |
26 Feb 07 |
jari |
66 |
setBounds(0, 0, 450, 400); |
2 |
26 Feb 07 |
jari |
67 |
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
2 |
26 Feb 07 |
jari |
68 |
setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
69 |
GridBagLayout gridbag = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
70 |
GridBagConstraints constraints = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
71 |
constraints.anchor = GridBagConstraints.CENTER; |
2 |
26 Feb 07 |
jari |
72 |
constraints.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
73 |
|
2 |
26 Feb 07 |
jari |
74 |
JPanel pane = new JPanel(); |
2 |
26 Feb 07 |
jari |
75 |
pane.setLayout(gridbag); |
2 |
26 Feb 07 |
jari |
76 |
pane.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
77 |
|
2 |
26 Feb 07 |
jari |
78 |
sPanel = new SampleSelectionPanel(); |
2 |
26 Feb 07 |
jari |
79 |
buildConstraints(constraints, 0, 0, 1, 1, 100, 10); |
2 |
26 Feb 07 |
jari |
80 |
|
2 |
26 Feb 07 |
jari |
81 |
gridbag.setConstraints(sPanel, constraints); |
2 |
26 Feb 07 |
jari |
82 |
pane.add(sPanel); |
2 |
26 Feb 07 |
jari |
83 |
|
2 |
26 Feb 07 |
jari |
84 |
iPanel = new IterationPanel(); |
2 |
26 Feb 07 |
jari |
85 |
buildConstraints(constraints, 0, 1, 1, 1, 100, 20); |
2 |
26 Feb 07 |
jari |
86 |
gridbag.setConstraints(iPanel, constraints); |
2 |
26 Feb 07 |
jari |
87 |
pane.add(iPanel); |
2 |
26 Feb 07 |
jari |
88 |
|
2 |
26 Feb 07 |
jari |
89 |
javax.swing.UIManager.put("TabbedPane.selected", Color.white); |
2 |
26 Feb 07 |
jari |
90 |
methodTabPane = new JTabbedPane(); |
2 |
26 Feb 07 |
jari |
91 |
|
2 |
26 Feb 07 |
jari |
92 |
kPanel = new KMCPanel(); |
2 |
26 Feb 07 |
jari |
93 |
cPanel = new CASTPanel(); |
2 |
26 Feb 07 |
jari |
94 |
|
2 |
26 Feb 07 |
jari |
95 |
methodTabPane.add("K-Means / K-Medians", kPanel); |
2 |
26 Feb 07 |
jari |
96 |
methodTabPane.add("CAST", cPanel); |
2 |
26 Feb 07 |
jari |
97 |
|
2 |
26 Feb 07 |
jari |
98 |
buildConstraints(constraints, 0, 2, 1, 1, 100, 90); |
2 |
26 Feb 07 |
jari |
99 |
gridbag.setConstraints(methodTabPane, constraints); |
2 |
26 Feb 07 |
jari |
100 |
pane.add(methodTabPane); |
2 |
26 Feb 07 |
jari |
101 |
|
2 |
26 Feb 07 |
jari |
102 |
takeAverageBox = new JCheckBox("Take Average", true); |
2 |
26 Feb 07 |
jari |
103 |
takeAverageBox.setEnabled(false); |
2 |
26 Feb 07 |
jari |
104 |
|
2 |
26 Feb 07 |
jari |
105 |
constraints.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
106 |
buildConstraints(constraints, 0, 2, 1, 1, 0, 30); |
2 |
26 Feb 07 |
jari |
107 |
|
2 |
26 Feb 07 |
jari |
108 |
addContent(pane); |
2 |
26 Feb 07 |
jari |
109 |
EventListener listener = new EventListener(); |
2 |
26 Feb 07 |
jari |
110 |
setActionListeners(listener); |
2 |
26 Feb 07 |
jari |
111 |
this.addWindowListener(listener); |
2 |
26 Feb 07 |
jari |
112 |
methodTabPane.addChangeListener(listener); |
2 |
26 Feb 07 |
jari |
// methodTabPane.addChangeListener(listener); |
2 |
26 Feb 07 |
jari |
114 |
pack(); |
2 |
26 Feb 07 |
jari |
115 |
setSize(600,450); |
2 |
26 Feb 07 |
jari |
// setResizable(false); |
2 |
26 Feb 07 |
jari |
117 |
} |
2 |
26 Feb 07 |
jari |
118 |
|
2 |
26 Feb 07 |
jari |
119 |
public void setVisible(boolean visible) { |
2 |
26 Feb 07 |
jari |
120 |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); |
2 |
26 Feb 07 |
jari |
121 |
setLocation((screenSize.width - getSize().width)/2, (screenSize.height - getSize().height)/2); |
2 |
26 Feb 07 |
jari |
122 |
|
2 |
26 Feb 07 |
jari |
123 |
super.setVisible(visible); |
2 |
26 Feb 07 |
jari |
124 |
|
2 |
26 Feb 07 |
jari |
125 |
if (visible) { |
2 |
26 Feb 07 |
jari |
126 |
okButton.requestFocus(); |
2 |
26 Feb 07 |
jari |
127 |
} |
2 |
26 Feb 07 |
jari |
128 |
} |
2 |
26 Feb 07 |
jari |
129 |
|
2 |
26 Feb 07 |
jari |
130 |
void buildConstraints(GridBagConstraints gbc, int gx, int gy, |
2 |
26 Feb 07 |
jari |
131 |
int gw, int gh, int wx, int wy) { |
2 |
26 Feb 07 |
jari |
132 |
|
2 |
26 Feb 07 |
jari |
133 |
gbc.gridx = gx; |
2 |
26 Feb 07 |
jari |
134 |
gbc.gridy = gy; |
2 |
26 Feb 07 |
jari |
135 |
gbc.gridwidth = gw; |
2 |
26 Feb 07 |
jari |
136 |
gbc.gridheight = gh; |
2 |
26 Feb 07 |
jari |
137 |
gbc.weightx = wx; |
2 |
26 Feb 07 |
jari |
138 |
gbc.weighty = wy; |
2 |
26 Feb 07 |
jari |
139 |
} |
2 |
26 Feb 07 |
jari |
140 |
|
2 |
26 Feb 07 |
jari |
141 |
class KMCPanel extends JPanel{ |
2 |
26 Feb 07 |
jari |
142 |
JRadioButton meansButton, mediansButton; |
2 |
26 Feb 07 |
jari |
143 |
JTextField intervalInputField; |
2 |
26 Feb 07 |
jari |
144 |
JTextField iterationInputField; |
2 |
26 Feb 07 |
jari |
145 |
|
2 |
26 Feb 07 |
jari |
146 |
KMCPanel() { |
2 |
26 Feb 07 |
jari |
147 |
GridBagLayout gridbag = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
148 |
GridBagConstraints constraints = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
149 |
|
2 |
26 Feb 07 |
jari |
150 |
this.setLayout(gridbag); |
2 |
26 Feb 07 |
jari |
151 |
this.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
152 |
this.setBorder(BorderFactory.createLineBorder(Color.lightGray,2)); |
2 |
26 Feb 07 |
jari |
153 |
|
2 |
26 Feb 07 |
jari |
154 |
JPanel panel1 = new JPanel(); |
2 |
26 Feb 07 |
jari |
155 |
GridBagLayout grid1 = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
156 |
panel1.setLayout(grid1); |
2 |
26 Feb 07 |
jari |
157 |
panel1.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
158 |
panel1.setBorder(BorderFactory.createEmptyBorder(10,10,15,10)); |
2 |
26 Feb 07 |
jari |
159 |
|
2 |
26 Feb 07 |
jari |
160 |
meansButton = new JRadioButton("Calculate means", true); |
2 |
26 Feb 07 |
jari |
161 |
meansButton.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
162 |
meansButton.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
163 |
meansButton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
164 |
mediansButton = new JRadioButton("Calculate medians", false); |
2 |
26 Feb 07 |
jari |
165 |
mediansButton.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
166 |
mediansButton.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
167 |
mediansButton.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
168 |
|
2 |
26 Feb 07 |
jari |
169 |
ButtonGroup chooseMeansOrMedians = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
170 |
chooseMeansOrMedians.add(meansButton); |
2 |
26 Feb 07 |
jari |
171 |
chooseMeansOrMedians.add(mediansButton); |
2 |
26 Feb 07 |
jari |
172 |
|
2 |
26 Feb 07 |
jari |
173 |
buildConstraints(constraints, 0, 0, 1, 1, 50, 100); |
2 |
26 Feb 07 |
jari |
174 |
grid1.setConstraints(meansButton, constraints); |
2 |
26 Feb 07 |
jari |
175 |
panel1.add(meansButton); |
2 |
26 Feb 07 |
jari |
176 |
|
2 |
26 Feb 07 |
jari |
177 |
buildConstraints(constraints, 1, 0, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
178 |
grid1.setConstraints(mediansButton, constraints); |
2 |
26 Feb 07 |
jari |
179 |
panel1.add(mediansButton); |
2 |
26 Feb 07 |
jari |
180 |
|
2 |
26 Feb 07 |
jari |
181 |
buildConstraints(constraints, 0, 0, 1, 1, 100, 40); |
2 |
26 Feb 07 |
jari |
182 |
constraints.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
183 |
gridbag.setConstraints(panel1, constraints); |
2 |
26 Feb 07 |
jari |
184 |
this.add(panel1); |
2 |
26 Feb 07 |
jari |
185 |
|
2 |
26 Feb 07 |
jari |
186 |
JPanel panel2 = new JPanel(); |
2 |
26 Feb 07 |
jari |
187 |
GridBagLayout grid2 = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
188 |
panel2.setLayout(grid2); |
2 |
26 Feb 07 |
jari |
189 |
panel2.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
190 |
|
2 |
26 Feb 07 |
jari |
191 |
constraints.fill = GridBagConstraints.NONE; |
2 |
26 Feb 07 |
jari |
192 |
|
2 |
26 Feb 07 |
jari |
193 |
JLabel intervalLabel = new JLabel("Maximum number of clusters (enter an integer > 0): "); |
2 |
26 Feb 07 |
jari |
194 |
intervalLabel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
195 |
buildConstraints(constraints, 0, 0, 1, 1, 50, 100); |
2 |
26 Feb 07 |
jari |
196 |
constraints.anchor = GridBagConstraints.EAST; |
2 |
26 Feb 07 |
jari |
197 |
grid2.setConstraints(intervalLabel, constraints); |
2 |
26 Feb 07 |
jari |
198 |
panel2.add(intervalLabel); |
2 |
26 Feb 07 |
jari |
199 |
|
2 |
26 Feb 07 |
jari |
200 |
intervalInputField = new JTextField("20", 7); |
2 |
26 Feb 07 |
jari |
201 |
buildConstraints(constraints, 1, 0, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
202 |
constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
203 |
grid2.setConstraints(intervalInputField, constraints); |
2 |
26 Feb 07 |
jari |
204 |
panel2.add(intervalInputField); |
2 |
26 Feb 07 |
jari |
205 |
|
2 |
26 Feb 07 |
jari |
206 |
JLabel iterationLabel = new JLabel("Maximum number of iterations (enter an integer > 0): "); |
2 |
26 Feb 07 |
jari |
207 |
iterationLabel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
208 |
buildConstraints(constraints, 0, 1, 1, 1, 50, 100); |
2 |
26 Feb 07 |
jari |
209 |
constraints.anchor = GridBagConstraints.EAST; |
2 |
26 Feb 07 |
jari |
210 |
constraints.insets.top = 10; |
2 |
26 Feb 07 |
jari |
211 |
grid2.setConstraints(iterationLabel, constraints); |
2 |
26 Feb 07 |
jari |
212 |
panel2.add(iterationLabel); |
2 |
26 Feb 07 |
jari |
213 |
|
2 |
26 Feb 07 |
jari |
214 |
iterationInputField = new JTextField("50", 7); |
2 |
26 Feb 07 |
jari |
215 |
buildConstraints(constraints, 1, 1, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
216 |
constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
217 |
grid2.setConstraints(iterationInputField, constraints); |
2 |
26 Feb 07 |
jari |
218 |
panel2.add(iterationInputField); |
2 |
26 Feb 07 |
jari |
219 |
constraints.insets.top = 0; |
2 |
26 Feb 07 |
jari |
220 |
constraints.anchor = GridBagConstraints.CENTER; |
2 |
26 Feb 07 |
jari |
221 |
|
2 |
26 Feb 07 |
jari |
222 |
buildConstraints(constraints, 0, 1, 1, 1, 0, 20); |
2 |
26 Feb 07 |
jari |
223 |
gridbag.setConstraints(panel2, constraints); |
2 |
26 Feb 07 |
jari |
224 |
this.add(panel2); |
2 |
26 Feb 07 |
jari |
225 |
|
2 |
26 Feb 07 |
jari |
226 |
JPanel textPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
227 |
GridBagLayout textGrid = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
228 |
textPanel.setLayout(textGrid); |
2 |
26 Feb 07 |
jari |
229 |
textPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
230 |
textPanel.setBorder(BorderFactory.createEmptyBorder(20,10,20,10)); |
2 |
26 Feb 07 |
jari |
231 |
|
2 |
26 Feb 07 |
jari |
232 |
JLabel label2 = new JLabel("K-Means / K-Medians will be run using a starting K (number of clusters) = 1,"); |
2 |
26 Feb 07 |
jari |
233 |
label2.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
234 |
constraints.anchor = GridBagConstraints.SOUTHWEST; |
2 |
26 Feb 07 |
jari |
235 |
buildConstraints(constraints, 0, 1, 1, 1, 100, 33); |
2 |
26 Feb 07 |
jari |
236 |
textGrid.setConstraints(label2, constraints); |
2 |
26 Feb 07 |
jari |
237 |
textPanel.add(label2); |
2 |
26 Feb 07 |
jari |
238 |
|
2 |
26 Feb 07 |
jari |
239 |
JLabel label3 = new JLabel("with K being incremented by 1 in each subsequent iteration, up to the"); |
2 |
26 Feb 07 |
jari |
240 |
label3.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
241 |
constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
242 |
buildConstraints(constraints, 0, 2, 1, 1, 0, 33); |
2 |
26 Feb 07 |
jari |
243 |
textGrid.setConstraints(label3, constraints); |
2 |
26 Feb 07 |
jari |
244 |
textPanel.add(label3); |
2 |
26 Feb 07 |
jari |
245 |
|
2 |
26 Feb 07 |
jari |
246 |
JLabel label4 = new JLabel("maximum number of clusters specified above"); |
2 |
26 Feb 07 |
jari |
247 |
label4.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
248 |
constraints.anchor = GridBagConstraints.NORTHWEST; |
2 |
26 Feb 07 |
jari |
249 |
buildConstraints(constraints, 0, 3, 1, 1, 0, 34); |
2 |
26 Feb 07 |
jari |
250 |
textGrid.setConstraints(label4, constraints); |
2 |
26 Feb 07 |
jari |
251 |
textPanel.add(label4); |
2 |
26 Feb 07 |
jari |
252 |
|
2 |
26 Feb 07 |
jari |
253 |
constraints.anchor = GridBagConstraints.CENTER; |
2 |
26 Feb 07 |
jari |
254 |
buildConstraints(constraints, 0, 2, 1, 1, 0, 40); |
2 |
26 Feb 07 |
jari |
255 |
gridbag.setConstraints(textPanel, constraints); |
2 |
26 Feb 07 |
jari |
256 |
this.add(textPanel); |
2 |
26 Feb 07 |
jari |
257 |
} |
2 |
26 Feb 07 |
jari |
258 |
} |
2 |
26 Feb 07 |
jari |
259 |
|
2 |
26 Feb 07 |
jari |
260 |
class CASTPanel extends JPanel { |
2 |
26 Feb 07 |
jari |
261 |
JTextField thresholdInputField; |
2 |
26 Feb 07 |
jari |
262 |
|
2 |
26 Feb 07 |
jari |
263 |
CASTPanel() { |
2 |
26 Feb 07 |
jari |
264 |
GridBagLayout gridbag = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
265 |
GridBagConstraints constraints = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
266 |
|
2 |
26 Feb 07 |
jari |
267 |
JPanel pane = new JPanel(); |
2 |
26 Feb 07 |
jari |
268 |
this.setLayout(gridbag); |
2 |
26 Feb 07 |
jari |
269 |
this.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
270 |
this.setBorder(BorderFactory.createLineBorder(Color.lightGray,2)); |
2 |
26 Feb 07 |
jari |
271 |
|
2 |
26 Feb 07 |
jari |
272 |
JPanel panel1 = new JPanel(); |
2 |
26 Feb 07 |
jari |
273 |
GridBagLayout grid1 = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
274 |
panel1.setLayout(grid1); |
2 |
26 Feb 07 |
jari |
275 |
panel1.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
276 |
|
2 |
26 Feb 07 |
jari |
277 |
JLabel thresholdLabel = new JLabel("Interval ( enter a value between 0 and 1): "); |
2 |
26 Feb 07 |
jari |
278 |
thresholdLabel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
279 |
buildConstraints(constraints, 0, 0, 1, 1, 50, 100); |
2 |
26 Feb 07 |
jari |
280 |
constraints.anchor = GridBagConstraints.EAST; |
2 |
26 Feb 07 |
jari |
281 |
grid1.setConstraints(thresholdLabel, constraints); |
2 |
26 Feb 07 |
jari |
282 |
panel1.add(thresholdLabel); |
2 |
26 Feb 07 |
jari |
283 |
|
2 |
26 Feb 07 |
jari |
284 |
thresholdInputField = new JTextField("0.1", 7); |
2 |
26 Feb 07 |
jari |
285 |
buildConstraints(constraints, 1, 0, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
286 |
constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
287 |
grid1.setConstraints(thresholdInputField, constraints); |
2 |
26 Feb 07 |
jari |
288 |
panel1.add(thresholdInputField); |
2 |
26 Feb 07 |
jari |
289 |
|
2 |
26 Feb 07 |
jari |
290 |
buildConstraints(constraints, 0, 0, 1, 1, 100, 60); |
2 |
26 Feb 07 |
jari |
291 |
constraints.anchor = GridBagConstraints.CENTER; |
2 |
26 Feb 07 |
jari |
//constraints.fill = GridBagConstraints.BOTH; |
2 |
26 Feb 07 |
jari |
293 |
gridbag.setConstraints(panel1, constraints); |
2 |
26 Feb 07 |
jari |
294 |
this.add(panel1); |
2 |
26 Feb 07 |
jari |
295 |
|
2 |
26 Feb 07 |
jari |
296 |
/* |
2 |
26 Feb 07 |
jari |
JLabel label1 = new JLabel("(Interval should be between 0 and 1)"); |
2 |
26 Feb 07 |
jari |
buildConstraints(constraints, 0, 1, 2, 1, 0, 10); |
2 |
26 Feb 07 |
jari |
//constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
gridbag.setConstraints(label1, constraints); |
2 |
26 Feb 07 |
jari |
this.add(label1); |
2 |
26 Feb 07 |
jari |
302 |
*/ |
2 |
26 Feb 07 |
jari |
303 |
|
2 |
26 Feb 07 |
jari |
304 |
JPanel textPanel = new JPanel(); |
2 |
26 Feb 07 |
jari |
305 |
GridBagLayout textGrid = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
306 |
textPanel.setLayout(textGrid); |
2 |
26 Feb 07 |
jari |
307 |
textPanel.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
308 |
textPanel.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); |
2 |
26 Feb 07 |
jari |
309 |
|
2 |
26 Feb 07 |
jari |
310 |
JLabel label2 = new JLabel("CAST will be run with threshold affinities starting with above interval,"); |
2 |
26 Feb 07 |
jari |
311 |
label2.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
312 |
buildConstraints(constraints, 0, 1, 1, 1, 100, 33); |
2 |
26 Feb 07 |
jari |
313 |
constraints.anchor = GridBagConstraints.SOUTHWEST; |
2 |
26 Feb 07 |
jari |
314 |
textGrid.setConstraints(label2, constraints); |
2 |
26 Feb 07 |
jari |
315 |
textPanel.add(label2); |
2 |
26 Feb 07 |
jari |
316 |
|
2 |
26 Feb 07 |
jari |
317 |
JLabel label3 = new JLabel("with affinity being incremented by the interval value in subsequent"); |
2 |
26 Feb 07 |
jari |
318 |
label3.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
319 |
buildConstraints(constraints, 0, 2, 1, 1, 0, 33); |
2 |
26 Feb 07 |
jari |
320 |
constraints.anchor = GridBagConstraints.WEST; |
2 |
26 Feb 07 |
jari |
321 |
textGrid.setConstraints(label3, constraints); |
2 |
26 Feb 07 |
jari |
322 |
textPanel.add(label3); |
2 |
26 Feb 07 |
jari |
323 |
|
2 |
26 Feb 07 |
jari |
324 |
JLabel label4 = new JLabel("iterations, up to a maximum threshold affinity of 1.0"); |
2 |
26 Feb 07 |
jari |
325 |
label4.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
326 |
buildConstraints(constraints, 0, 3, 1, 1, 0, 34); |
2 |
26 Feb 07 |
jari |
327 |
constraints.anchor = GridBagConstraints.NORTHWEST; |
2 |
26 Feb 07 |
jari |
328 |
textGrid.setConstraints(label4, constraints); |
2 |
26 Feb 07 |
jari |
329 |
textPanel.add(label4); |
2 |
26 Feb 07 |
jari |
330 |
|
2 |
26 Feb 07 |
jari |
331 |
constraints.anchor = GridBagConstraints.CENTER; |
2 |
26 Feb 07 |
jari |
332 |
buildConstraints(constraints, 0, 1, 1, 1, 0, 40); |
2 |
26 Feb 07 |
jari |
333 |
gridbag.setConstraints(textPanel, constraints); |
2 |
26 Feb 07 |
jari |
334 |
this.add(textPanel); |
2 |
26 Feb 07 |
jari |
335 |
|
2 |
26 Feb 07 |
jari |
336 |
} |
2 |
26 Feb 07 |
jari |
337 |
} |
2 |
26 Feb 07 |
jari |
338 |
|
2 |
26 Feb 07 |
jari |
339 |
|
2 |
26 Feb 07 |
jari |
340 |
public boolean isOkPressed() { |
2 |
26 Feb 07 |
jari |
341 |
return okPressed; |
2 |
26 Feb 07 |
jari |
342 |
} |
2 |
26 Feb 07 |
jari |
343 |
|
2 |
26 Feb 07 |
jari |
344 |
|
2 |
26 Feb 07 |
jari |
345 |
public int getMethod() { |
2 |
26 Feb 07 |
jari |
346 |
int method = 0; |
2 |
26 Feb 07 |
jari |
347 |
if (methodTabPane.getSelectedIndex() == 0) { |
2 |
26 Feb 07 |
jari |
348 |
method = KMEANS; |
2 |
26 Feb 07 |
jari |
349 |
} else if(methodTabPane.getSelectedIndex() == 1) { |
2 |
26 Feb 07 |
jari |
350 |
method = CAST; |
2 |
26 Feb 07 |
jari |
351 |
} |
2 |
26 Feb 07 |
jari |
352 |
|
2 |
26 Feb 07 |
jari |
353 |
return method; |
2 |
26 Feb 07 |
jari |
354 |
} |
2 |
26 Feb 07 |
jari |
355 |
|
2 |
26 Feb 07 |
jari |
356 |
public boolean useMeans() { |
2 |
26 Feb 07 |
jari |
357 |
return kPanel.meansButton.isSelected(); |
2 |
26 Feb 07 |
jari |
358 |
} |
2 |
26 Feb 07 |
jari |
359 |
|
2 |
26 Feb 07 |
jari |
360 |
public float getInterval() { |
2 |
26 Feb 07 |
jari |
361 |
String s2 = cPanel.thresholdInputField.getText(); |
2 |
26 Feb 07 |
jari |
362 |
float interval = Float.parseFloat(s2); |
2 |
26 Feb 07 |
jari |
363 |
return interval; |
2 |
26 Feb 07 |
jari |
364 |
} |
2 |
26 Feb 07 |
jari |
365 |
|
2 |
26 Feb 07 |
jari |
366 |
public int getIterations() { |
2 |
26 Feb 07 |
jari |
367 |
String s1 = kPanel.intervalInputField.getText(); |
2 |
26 Feb 07 |
jari |
368 |
int k = Integer.parseInt(s1); |
2 |
26 Feb 07 |
jari |
369 |
return k; |
2 |
26 Feb 07 |
jari |
370 |
} |
2 |
26 Feb 07 |
jari |
371 |
|
2 |
26 Feb 07 |
jari |
372 |
public int getKMCIterations(){ |
2 |
26 Feb 07 |
jari |
373 |
String s1 = kPanel.iterationInputField.getText(); |
2 |
26 Feb 07 |
jari |
374 |
int iterations = Integer.parseInt(s1); |
2 |
26 Feb 07 |
jari |
375 |
return iterations; |
2 |
26 Feb 07 |
jari |
376 |
} |
2 |
26 Feb 07 |
jari |
377 |
|
2 |
26 Feb 07 |
jari |
378 |
public int getFOMIterations() { |
2 |
26 Feb 07 |
jari |
379 |
String s = iPanel.iterationField.getText(); |
2 |
26 Feb 07 |
jari |
380 |
return Integer.parseInt(s); |
2 |
26 Feb 07 |
jari |
381 |
} |
2 |
26 Feb 07 |
jari |
382 |
|
2 |
26 Feb 07 |
jari |
383 |
public boolean isAverage() { |
2 |
26 Feb 07 |
jari |
384 |
return takeAverageBox.isSelected(); |
2 |
26 Feb 07 |
jari |
385 |
} |
2 |
26 Feb 07 |
jari |
386 |
|
2 |
26 Feb 07 |
jari |
387 |
public boolean isClusterGenes(){ |
2 |
26 Feb 07 |
jari |
388 |
return sPanel.calcGenes.isSelected(); |
2 |
26 Feb 07 |
jari |
389 |
} |
2 |
26 Feb 07 |
jari |
390 |
|
2 |
26 Feb 07 |
jari |
391 |
private void resetControls(){ |
2 |
26 Feb 07 |
jari |
// this.methodTabPane.setSelectedIndex(0); set kmc as reset value??? |
2 |
26 Feb 07 |
jari |
393 |
this.sPanel.calcGenes.setSelected(true); |
2 |
26 Feb 07 |
jari |
394 |
kPanel.meansButton.setSelected(true); |
2 |
26 Feb 07 |
jari |
395 |
kPanel.intervalInputField.setText("20"); |
2 |
26 Feb 07 |
jari |
396 |
kPanel.iterationInputField.setText("50"); |
2 |
26 Feb 07 |
jari |
397 |
cPanel.thresholdInputField.setText("0.1"); |
2 |
26 Feb 07 |
jari |
398 |
iPanel.iterationField.setText("1"); |
2 |
26 Feb 07 |
jari |
399 |
} |
2 |
26 Feb 07 |
jari |
400 |
|
2 |
26 Feb 07 |
jari |
401 |
public static void main(String[] args) { |
2 |
26 Feb 07 |
jari |
402 |
JFrame dummyFrame = new JFrame(); |
2 |
26 Feb 07 |
jari |
403 |
FOMInitDialog fDialog = new FOMInitDialog(dummyFrame, true); |
2 |
26 Feb 07 |
jari |
404 |
fDialog.show(); |
2 |
26 Feb 07 |
jari |
405 |
System.out.println(fDialog.getIterations()); |
2 |
26 Feb 07 |
jari |
406 |
System.exit(0); |
2 |
26 Feb 07 |
jari |
407 |
} |
2 |
26 Feb 07 |
jari |
408 |
|
2 |
26 Feb 07 |
jari |
409 |
class SampleSelectionPanel extends JPanel{ |
2 |
26 Feb 07 |
jari |
410 |
JRadioButton calcGenes; |
2 |
26 Feb 07 |
jari |
411 |
JRadioButton calcExperiments; |
2 |
26 Feb 07 |
jari |
412 |
|
2 |
26 Feb 07 |
jari |
413 |
SampleSelectionPanel() { |
2 |
26 Feb 07 |
jari |
414 |
this.setBorder(new TitledBorder(new EtchedBorder(), "Sample Selection", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12) ,Color.black)); |
2 |
26 Feb 07 |
jari |
415 |
this.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
416 |
GridBagLayout gridbag = new GridBagLayout(); |
2 |
26 Feb 07 |
jari |
417 |
GridBagConstraints constraints = new GridBagConstraints(); |
2 |
26 Feb 07 |
jari |
418 |
this.setLayout(gridbag); |
2 |
26 Feb 07 |
jari |
419 |
|
2 |
26 Feb 07 |
jari |
420 |
calcGenes = new JRadioButton("Gene Cluster FOM", true); |
2 |
26 Feb 07 |
jari |
421 |
calcGenes.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
422 |
calcGenes.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
423 |
calcGenes.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
424 |
buildConstraints(constraints, 0, 0, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
425 |
gridbag.setConstraints(calcGenes, constraints); |
2 |
26 Feb 07 |
jari |
426 |
this.add(calcGenes); |
2 |
26 Feb 07 |
jari |
427 |
|
2 |
26 Feb 07 |
jari |
428 |
calcExperiments = new JRadioButton("Sample Cluster FOM"); |
2 |
26 Feb 07 |
jari |
429 |
calcExperiments.setFocusPainted(false); |
2 |
26 Feb 07 |
jari |
430 |
calcExperiments.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
431 |
calcExperiments.setForeground(UIManager.getColor("Label.foreground")); |
2 |
26 Feb 07 |
jari |
432 |
buildConstraints(constraints, 1, 0, 1, 1, 50, 0); |
2 |
26 Feb 07 |
jari |
433 |
gridbag.setConstraints(calcExperiments, constraints); |
2 |
26 Feb 07 |
jari |
434 |
this.add(calcExperiments); |
2 |
26 Feb 07 |
jari |
435 |
|
2 |
26 Feb 07 |
jari |
436 |
ButtonGroup group = new ButtonGroup(); |
2 |
26 Feb 07 |
jari |
437 |
group.add(calcGenes); |
2 |
26 Feb 07 |
jari |
438 |
group.add(calcExperiments); |
2 |
26 Feb 07 |
jari |
439 |
} |
2 |
26 Feb 07 |
jari |
440 |
} |
2 |
26 Feb 07 |
jari |
441 |
|
2 |
26 Feb 07 |
jari |
442 |
private class IterationPanel extends ParameterPanel { |
2 |
26 Feb 07 |
jari |
443 |
|
2 |
26 Feb 07 |
jari |
444 |
JLabel iterationLabel; |
2 |
26 Feb 07 |
jari |
445 |
JTextField iterationField; |
2 |
26 Feb 07 |
jari |
446 |
|
2 |
26 Feb 07 |
jari |
447 |
public IterationPanel() { |
2 |
26 Feb 07 |
jari |
448 |
super("FOM Iteration Selection"); |
2 |
26 Feb 07 |
jari |
449 |
setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
450 |
iterationLabel = new JLabel("Number of FOM Iterations"); |
2 |
26 Feb 07 |
jari |
451 |
iterationLabel.setOpaque(false); |
2 |
26 Feb 07 |
jari |
452 |
iterationField = new JTextField("1", 5); |
2 |
26 Feb 07 |
jari |
453 |
add(iterationLabel, new GridBagConstraints(0,0,1,1,0,0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10,10,10,10), 0, 0)); |
2 |
26 Feb 07 |
jari |
454 |
add(iterationField, new GridBagConstraints(1,0,1,1,0,0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10,10,10,10), 0, 0)); |
2 |
26 Feb 07 |
jari |
455 |
} |
2 |
26 Feb 07 |
jari |
456 |
|
2 |
26 Feb 07 |
jari |
457 |
public void setEnabled(boolean enable) { |
2 |
26 Feb 07 |
jari |
458 |
iterationLabel.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
459 |
iterationField.setEnabled(enable); |
2 |
26 Feb 07 |
jari |
460 |
if(enable) |
2 |
26 Feb 07 |
jari |
461 |
iterationField.setBackground(Color.white); |
2 |
26 Feb 07 |
jari |
462 |
else |
2 |
26 Feb 07 |
jari |
463 |
iterationField.setBackground(Color.lightGray); |
2 |
26 Feb 07 |
jari |
464 |
} |
2 |
26 Feb 07 |
jari |
465 |
} |
2 |
26 Feb 07 |
jari |
466 |
|
2 |
26 Feb 07 |
jari |
467 |
protected class EventListener extends WindowAdapter implements ActionListener, ChangeListener{ |
2 |
26 Feb 07 |
jari |
468 |
public void actionPerformed(ActionEvent event) { |
2 |
26 Feb 07 |
jari |
469 |
String command = event.getActionCommand(); |
2 |
26 Feb 07 |
jari |
470 |
if (command.equals("ok-command")) { |
2 |
26 Feb 07 |
jari |
471 |
okPressed = true; |
2 |
26 Feb 07 |
jari |
472 |
int method = FOMInitDialog.this.methodTabPane.getSelectedIndex(); |
2 |
26 Feb 07 |
jari |
473 |
int fomI = 1; |
2 |
26 Feb 07 |
jari |
//KMC |
2 |
26 Feb 07 |
jari |
475 |
int k = -1; |
2 |
26 Feb 07 |
jari |
476 |
float inter = -1.0f, kmcIter = -1, progress = -1; |
2 |
26 Feb 07 |
jari |
477 |
try{ |
2 |
26 Feb 07 |
jari |
478 |
if(method == 0){ |
2 |
26 Feb 07 |
jari |
479 |
fomI = Integer.parseInt(iPanel.iterationField.getText()); |
2 |
26 Feb 07 |
jari |
480 |
progress++; |
2 |
26 Feb 07 |
jari |
481 |
k = Integer.parseInt(FOMInitDialog.this.kPanel.intervalInputField.getText()); |
2 |
26 Feb 07 |
jari |
482 |
progress++; |
2 |
26 Feb 07 |
jari |
483 |
kmcIter = Integer.parseInt(kPanel.iterationInputField.getText()); |
2 |
26 Feb 07 |
jari |
484 |
progress++; |
2 |
26 Feb 07 |
jari |
485 |
} |
2 |
26 Feb 07 |
jari |
486 |
else{ |
2 |
26 Feb 07 |
jari |
487 |
inter = Float.parseFloat(FOMInitDialog.this.cPanel.thresholdInputField.getText()); |
2 |
26 Feb 07 |
jari |
488 |
} |
2 |
26 Feb 07 |
jari |
489 |
} catch (NumberFormatException e){ |
2 |
26 Feb 07 |
jari |
490 |
if(progress == -1) { |
2 |
26 Feb 07 |
jari |
491 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Number format error. Expecting an integer for FOM iteration parameter.", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
492 |
iPanel.iterationField.requestFocus(); |
2 |
26 Feb 07 |
jari |
493 |
iPanel.iterationField.selectAll(); |
2 |
26 Feb 07 |
jari |
494 |
} else if(method == 0){ |
2 |
26 Feb 07 |
jari |
495 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Number format error.", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
496 |
if(progress == 0){ |
2 |
26 Feb 07 |
jari |
497 |
kPanel.intervalInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
498 |
kPanel.intervalInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
499 |
} |
2 |
26 Feb 07 |
jari |
500 |
else { |
2 |
26 Feb 07 |
jari |
501 |
kPanel.iterationInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
502 |
kPanel.iterationInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
503 |
} |
2 |
26 Feb 07 |
jari |
504 |
} else { |
2 |
26 Feb 07 |
jari |
505 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Number format error.", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
506 |
cPanel.thresholdInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
507 |
cPanel.thresholdInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
508 |
} |
2 |
26 Feb 07 |
jari |
509 |
return; |
2 |
26 Feb 07 |
jari |
510 |
} |
2 |
26 Feb 07 |
jari |
511 |
if(method == 0){ |
2 |
26 Feb 07 |
jari |
512 |
if(fomI < 1) { |
2 |
26 Feb 07 |
jari |
513 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "FOM iterations must be > 0", "Invalid Input Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
514 |
iPanel.iterationField.requestFocus(); |
2 |
26 Feb 07 |
jari |
515 |
iPanel.iterationField.selectAll(); |
2 |
26 Feb 07 |
jari |
516 |
return; |
2 |
26 Feb 07 |
jari |
517 |
} |
2 |
26 Feb 07 |
jari |
518 |
if(k < 1){ |
2 |
26 Feb 07 |
jari |
519 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Maximum Number of Clusters must be > 0", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
520 |
kPanel.intervalInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
521 |
kPanel.intervalInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
522 |
return; |
2 |
26 Feb 07 |
jari |
523 |
} |
2 |
26 Feb 07 |
jari |
524 |
if(kmcIter < 1){ |
2 |
26 Feb 07 |
jari |
525 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Maximum Number of intervals per KMC run must be > 0", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
526 |
kPanel.iterationInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
527 |
kPanel.iterationInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
528 |
return; |
2 |
26 Feb 07 |
jari |
529 |
} |
2 |
26 Feb 07 |
jari |
530 |
|
2 |
26 Feb 07 |
jari |
531 |
} else { |
2 |
26 Feb 07 |
jari |
532 |
if(inter <= 0 || inter >= 1.0f){ |
2 |
26 Feb 07 |
jari |
533 |
JOptionPane.showMessageDialog(FOMInitDialog.this, "Interval must be > 0 and < 1.0", "Number Format Error", JOptionPane.ERROR_MESSAGE); |
2 |
26 Feb 07 |
jari |
534 |
cPanel.thresholdInputField.requestFocus(); |
2 |
26 Feb 07 |
jari |
535 |
cPanel.thresholdInputField.selectAll(); |
2 |
26 Feb 07 |
jari |
536 |
return; |
2 |
26 Feb 07 |
jari |
537 |
} |
2 |
26 Feb 07 |
jari |
538 |
} |
2 |
26 Feb 07 |
jari |
539 |
javax.swing.UIManager.put("TabbedPane.selected", Color.lightGray); |
2 |
26 Feb 07 |
jari |
540 |
dispose(); |
2 |
26 Feb 07 |
jari |
541 |
} else if (command.equals("cancel-command")){ |
2 |
26 Feb 07 |
jari |
542 |
javax.swing.UIManager.put("TabbedPane.selected", Color.lightGray); |
2 |
26 Feb 07 |
jari |
543 |
dispose(); |
2 |
26 Feb 07 |
jari |
544 |
} else if (command.equals("reset-command")){ |
2 |
26 Feb 07 |
jari |
545 |
resetControls(); |
2 |
26 Feb 07 |
jari |
546 |
} else if (command.equals("info-command")){ |
2 |
26 Feb 07 |
jari |
547 |
HelpWindow helpWindow = new HelpWindow(FOMInitDialog.this, "FOM Initialization Dialog"); |
2 |
26 Feb 07 |
jari |
548 |
if(helpWindow.getWindowContent()){ |
2 |
26 Feb 07 |
jari |
549 |
helpWindow.setSize(450, 600); |
2 |
26 Feb 07 |
jari |
550 |
helpWindow.setLocation(); |
2 |
26 Feb 07 |
jari |
551 |
helpWindow.show(); |
2 |
26 Feb 07 |
jari |
552 |
} |
2 |
26 Feb 07 |
jari |
553 |
else{ |
2 |
26 Feb 07 |
jari |
554 |
helpWindow.dispose(); |
2 |
26 Feb 07 |
jari |
555 |
} |
2 |
26 Feb 07 |
jari |
556 |
} |
2 |
26 Feb 07 |
jari |
557 |
} |
2 |
26 Feb 07 |
jari |
558 |
public void windowClosing(java.awt.event.WindowEvent we){ |
2 |
26 Feb 07 |
jari |
559 |
javax.swing.UIManager.put("TabbedPane.selected", Color.lightGray); |
2 |
26 Feb 07 |
jari |
560 |
} |
2 |
26 Feb 07 |
jari |
561 |
|
2 |
26 Feb 07 |
jari |
562 |
public void stateChanged(javax.swing.event.ChangeEvent changeEvent) { |
2 |
26 Feb 07 |
jari |
//only methodTabbedPane has change events listener |
2 |
26 Feb 07 |
jari |
564 |
JTabbedPane tPane = (JTabbedPane)(changeEvent.getSource()); |
2 |
26 Feb 07 |
jari |
565 |
if(tPane.getSelectedIndex() == 0) |
2 |
26 Feb 07 |
jari |
566 |
iPanel.setEnabled(true); |
2 |
26 Feb 07 |
jari |
567 |
else |
2 |
26 Feb 07 |
jari |
568 |
iPanel.setEnabled(false); |
2 |
26 Feb 07 |
jari |
569 |
} |
2 |
26 Feb 07 |
jari |
570 |
|
2 |
26 Feb 07 |
jari |
571 |
} |
2 |
26 Feb 07 |
jari |
572 |
|
2 |
26 Feb 07 |
jari |
573 |
|
2 |
26 Feb 07 |
jari |
574 |
|
2 |
26 Feb 07 |
jari |
575 |
|
2 |
26 Feb 07 |
jari |
576 |
} |