2 |
26 Feb 07 |
jari |
1 |
/* |
2 |
26 Feb 07 |
jari |
Copyright @ 1999-2003, 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: SetConfidenceDialog.java,v $ |
2 |
26 Feb 07 |
jari |
* $Revision: 1.4 $ |
2 |
26 Feb 07 |
jari |
* $Date: 2006/02/23 20:59:41 $ |
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; |
2 |
26 Feb 07 |
jari |
13 |
|
2 |
26 Feb 07 |
jari |
14 |
import java.awt.GridBagLayout; |
2 |
26 Feb 07 |
jari |
15 |
import java.awt.Insets; |
2 |
26 Feb 07 |
jari |
16 |
import java.awt.event.ActionEvent; |
2 |
26 Feb 07 |
jari |
17 |
import java.awt.event.ActionListener; |
2 |
26 Feb 07 |
jari |
18 |
import java.awt.event.KeyEvent; |
2 |
26 Feb 07 |
jari |
19 |
import java.awt.event.KeyListener; |
2 |
26 Feb 07 |
jari |
20 |
import java.util.Hashtable; |
2 |
26 Feb 07 |
jari |
21 |
|
2 |
26 Feb 07 |
jari |
22 |
import javax.swing.JButton; |
2 |
26 Feb 07 |
jari |
23 |
import javax.swing.JComboBox; |
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.JFrame; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
26 |
|
2 |
26 Feb 07 |
jari |
27 |
import org.tigr.util.awt.ActionInfoDialog; |
2 |
26 Feb 07 |
jari |
28 |
import org.tigr.util.awt.ActionInfoEvent; |
2 |
26 Feb 07 |
jari |
29 |
import org.tigr.util.awt.GBA; |
2 |
26 Feb 07 |
jari |
30 |
|
2 |
26 Feb 07 |
jari |
31 |
public class SetConfidenceDialog extends ActionInfoDialog { |
2 |
26 Feb 07 |
jari |
32 |
private JFrame parent; |
2 |
26 Feb 07 |
jari |
33 |
GBA gba; |
2 |
26 Feb 07 |
jari |
34 |
JLabel confidenceLabel; |
2 |
26 Feb 07 |
jari |
35 |
JComboBox confidenceChoice; |
2 |
26 Feb 07 |
jari |
36 |
JButton okButton, cancelButton; |
2 |
26 Feb 07 |
jari |
37 |
|
2 |
26 Feb 07 |
jari |
38 |
public SetConfidenceDialog(JFrame parent) { |
2 |
26 Feb 07 |
jari |
39 |
super(parent, true); |
2 |
26 Feb 07 |
jari |
40 |
try { |
2 |
26 Feb 07 |
jari |
41 |
this.parent = parent; |
2 |
26 Feb 07 |
jari |
42 |
gba = new GBA(); |
2 |
26 Feb 07 |
jari |
43 |
|
2 |
26 Feb 07 |
jari |
44 |
confidenceLabel = new JLabel("Select a confidence level (%): "); |
2 |
26 Feb 07 |
jari |
45 |
confidenceLabel.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
46 |
confidenceChoice = new JComboBox(); |
2 |
26 Feb 07 |
jari |
47 |
confidenceChoice.addItem("95"); |
2 |
26 Feb 07 |
jari |
48 |
confidenceChoice.addItem("99"); |
2 |
26 Feb 07 |
jari |
49 |
confidenceChoice.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
50 |
okButton = new JButton("Okay"); |
2 |
26 Feb 07 |
jari |
51 |
okButton.addActionListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
52 |
cancelButton = new JButton("Cancel"); |
2 |
26 Feb 07 |
jari |
53 |
cancelButton.addActionListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
54 |
|
2 |
26 Feb 07 |
jari |
55 |
contentPane.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
56 |
gba.add(contentPane, confidenceLabel, 0, 0, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
57 |
gba.add(contentPane, confidenceChoice, 1, 0, 1, 1, 1, 1, GBA.B, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
58 |
gba.add(contentPane, cancelButton, 0, 1, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
59 |
gba.add(contentPane, okButton, 1, 1, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
60 |
|
2 |
26 Feb 07 |
jari |
61 |
pack(); |
2 |
26 Feb 07 |
jari |
62 |
setResizable(false); |
2 |
26 Feb 07 |
jari |
63 |
setTitle("Set Confidence Level"); |
2 |
26 Feb 07 |
jari |
64 |
confidenceChoice.requestFocus(); |
2 |
26 Feb 07 |
jari |
65 |
setLocation(400,250); |
2 |
26 Feb 07 |
jari |
66 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
67 |
System.out.println("Exception (SetConfidenceDialog.const()): " + e); |
2 |
26 Feb 07 |
jari |
68 |
} |
2 |
26 Feb 07 |
jari |
69 |
} |
2 |
26 Feb 07 |
jari |
70 |
|
2 |
26 Feb 07 |
jari |
71 |
class EventListener implements ActionListener, KeyListener { |
2 |
26 Feb 07 |
jari |
72 |
public void actionPerformed(ActionEvent event) { |
2 |
26 Feb 07 |
jari |
73 |
if (event.getSource() == okButton) { |
2 |
26 Feb 07 |
jari |
74 |
String confidenceString = (String) confidenceChoice.getSelectedItem(); |
2 |
26 Feb 07 |
jari |
75 |
|
2 |
26 Feb 07 |
jari |
76 |
Hashtable hash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
77 |
|
2 |
26 Feb 07 |
jari |
78 |
if (confidenceString.equals("99")) { |
2 |
26 Feb 07 |
jari |
//((DisplayApplet) parent.getSlideApplet()).normalizeData(SlideData.RATIO_STATISTICS_99); |
2 |
26 Feb 07 |
jari |
80 |
hash.put(new String("confidence"), new Integer(99)); |
2 |
26 Feb 07 |
jari |
81 |
} else { |
2 |
26 Feb 07 |
jari |
//((DisplayApplet) parent.getSlideApplet()).normalizeData(SlideData.RATIO_STATISTICS_95); |
2 |
26 Feb 07 |
jari |
83 |
hash.put(new String("confidence"), new Integer(95)); |
2 |
26 Feb 07 |
jari |
84 |
} |
2 |
26 Feb 07 |
jari |
85 |
fireEvent(new ActionInfoEvent(this, hash)); |
2 |
26 Feb 07 |
jari |
86 |
dispose(); |
2 |
26 Feb 07 |
jari |
87 |
} else if (event.getSource() == cancelButton) dispose(); |
2 |
26 Feb 07 |
jari |
88 |
} |
2 |
26 Feb 07 |
jari |
89 |
|
2 |
26 Feb 07 |
jari |
90 |
public void keyPressed(KeyEvent event) { |
2 |
26 Feb 07 |
jari |
91 |
if (event.getKeyCode() == KeyEvent.VK_ENTER) { |
2 |
26 Feb 07 |
jari |
92 |
String confidenceString = (String) confidenceChoice.getSelectedItem(); |
2 |
26 Feb 07 |
jari |
93 |
|
2 |
26 Feb 07 |
jari |
94 |
Hashtable hash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
95 |
|
2 |
26 Feb 07 |
jari |
96 |
if (confidenceString.equals("99")) { |
2 |
26 Feb 07 |
jari |
//((DisplayApplet) parent.getSlideApplet()).normalizeData(SlideData.RATIO_STATISTICS_99); |
2 |
26 Feb 07 |
jari |
98 |
hash.put(new String("confidence"), new Integer(99)); |
2 |
26 Feb 07 |
jari |
99 |
} else { |
2 |
26 Feb 07 |
jari |
//((DisplayApplet) parent.getSlideApplet()).normalizeData(SlideData.RATIO_STATISTICS_95); |
2 |
26 Feb 07 |
jari |
101 |
hash.put(new String("confidence"), new Integer(95)); |
2 |
26 Feb 07 |
jari |
102 |
} |
2 |
26 Feb 07 |
jari |
103 |
fireEvent(new ActionInfoEvent(this, hash)); |
2 |
26 Feb 07 |
jari |
104 |
dispose(); |
2 |
26 Feb 07 |
jari |
105 |
} |
2 |
26 Feb 07 |
jari |
106 |
} |
2 |
26 Feb 07 |
jari |
107 |
|
2 |
26 Feb 07 |
jari |
108 |
public void keyReleased(KeyEvent event) {;} |
2 |
26 Feb 07 |
jari |
109 |
public void keyTyped(KeyEvent event) {;} |
2 |
26 Feb 07 |
jari |
110 |
} |
2 |
26 Feb 07 |
jari |
111 |
} |