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: SetMetaLocationDialog.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.JFrame; |
2 |
26 Feb 07 |
jari |
24 |
import javax.swing.JLabel; |
2 |
26 Feb 07 |
jari |
25 |
import javax.swing.JTextField; |
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 SetMetaLocationDialog extends ActionInfoDialog { |
2 |
26 Feb 07 |
jari |
32 |
private JFrame parent; |
2 |
26 Feb 07 |
jari |
33 |
JLabel rowLabel, columnLabel; |
2 |
26 Feb 07 |
jari |
34 |
JTextField rowTextField, columnTextField; |
2 |
26 Feb 07 |
jari |
35 |
JButton okButton, cancelButton; |
2 |
26 Feb 07 |
jari |
36 |
GBA gba; |
2 |
26 Feb 07 |
jari |
37 |
|
2 |
26 Feb 07 |
jari |
38 |
public SetMetaLocationDialog(JFrame parent) { |
2 |
26 Feb 07 |
jari |
39 |
super(parent, true); |
2 |
26 Feb 07 |
jari |
40 |
|
2 |
26 Feb 07 |
jari |
41 |
try { |
2 |
26 Feb 07 |
jari |
42 |
this.parent = parent; |
2 |
26 Feb 07 |
jari |
43 |
gba = new GBA(); |
2 |
26 Feb 07 |
jari |
44 |
|
2 |
26 Feb 07 |
jari |
45 |
rowLabel = new JLabel("Meta Row: "); |
2 |
26 Feb 07 |
jari |
46 |
rowLabel.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
47 |
|
2 |
26 Feb 07 |
jari |
48 |
rowTextField = new JTextField(10); |
2 |
26 Feb 07 |
jari |
49 |
rowTextField.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
50 |
|
2 |
26 Feb 07 |
jari |
51 |
columnLabel = new JLabel("Meta Column: "); |
2 |
26 Feb 07 |
jari |
52 |
columnLabel.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
53 |
|
2 |
26 Feb 07 |
jari |
54 |
columnTextField = new JTextField(10); |
2 |
26 Feb 07 |
jari |
55 |
columnTextField.addKeyListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
56 |
|
2 |
26 Feb 07 |
jari |
57 |
cancelButton = new JButton("Cancel"); |
2 |
26 Feb 07 |
jari |
58 |
cancelButton.addActionListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
59 |
|
2 |
26 Feb 07 |
jari |
60 |
okButton = new JButton("Okay"); |
2 |
26 Feb 07 |
jari |
61 |
okButton.addActionListener(new EventListener()); |
2 |
26 Feb 07 |
jari |
62 |
|
2 |
26 Feb 07 |
jari |
63 |
contentPane.setLayout(new GridBagLayout()); |
2 |
26 Feb 07 |
jari |
64 |
gba.add(contentPane, rowLabel, 0, 0, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
65 |
gba.add(contentPane, rowTextField, 1, 0, 1, 1, 1, 1, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
66 |
gba.add(contentPane, columnLabel, 0, 1, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
67 |
gba.add(contentPane, columnTextField, 1, 1, 1, 1, 1, 1, GBA.H, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
68 |
gba.add(contentPane, cancelButton, 0, 2, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
69 |
gba.add(contentPane, okButton, 1, 2, 1, 1, 0, 0, GBA.NONE, GBA.C, new Insets(5, 5, 5, 5), 0, 0); |
2 |
26 Feb 07 |
jari |
70 |
|
2 |
26 Feb 07 |
jari |
71 |
pack(); |
2 |
26 Feb 07 |
jari |
72 |
setResizable(false); |
2 |
26 Feb 07 |
jari |
73 |
setTitle("Select MetaBlock"); |
2 |
26 Feb 07 |
jari |
74 |
rowTextField.grabFocus(); |
2 |
26 Feb 07 |
jari |
75 |
setLocation(225, 225); |
2 |
26 Feb 07 |
jari |
76 |
} catch (Exception e) { |
2 |
26 Feb 07 |
jari |
77 |
System.out.println("Exception (SetMetaLocation.const()): " + e); |
2 |
26 Feb 07 |
jari |
78 |
} |
2 |
26 Feb 07 |
jari |
79 |
} |
2 |
26 Feb 07 |
jari |
80 |
|
2 |
26 Feb 07 |
jari |
81 |
class EventListener implements ActionListener, KeyListener { |
2 |
26 Feb 07 |
jari |
82 |
public void actionPerformed(ActionEvent event) { |
2 |
26 Feb 07 |
jari |
83 |
if (event.getSource() == okButton) { |
2 |
26 Feb 07 |
jari |
84 |
String row = rowTextField.getText(); |
2 |
26 Feb 07 |
jari |
85 |
String column = columnTextField.getText(); |
2 |
26 Feb 07 |
jari |
86 |
|
2 |
26 Feb 07 |
jari |
//((DisplayFrame) parent).getDisplayApplet().createRegion(Integer.parseInt(row), Integer.parseInt(column)); |
2 |
26 Feb 07 |
jari |
88 |
Hashtable hash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
89 |
hash.put(new String("row"), row); |
2 |
26 Feb 07 |
jari |
90 |
hash.put(new String("column"), column); |
2 |
26 Feb 07 |
jari |
91 |
fireEvent(new ActionInfoEvent(this, hash)); |
2 |
26 Feb 07 |
jari |
92 |
|
2 |
26 Feb 07 |
jari |
93 |
dispose(); |
2 |
26 Feb 07 |
jari |
94 |
} else if (event.getSource() == cancelButton) dispose(); |
2 |
26 Feb 07 |
jari |
95 |
} |
2 |
26 Feb 07 |
jari |
96 |
|
2 |
26 Feb 07 |
jari |
97 |
public void keyPressed(KeyEvent event) { |
2 |
26 Feb 07 |
jari |
98 |
if (event.getKeyCode() == KeyEvent.VK_ENTER) { |
2 |
26 Feb 07 |
jari |
99 |
String row = rowTextField.getText(); |
2 |
26 Feb 07 |
jari |
100 |
String column = columnTextField.getText(); |
2 |
26 Feb 07 |
jari |
101 |
|
2 |
26 Feb 07 |
jari |
//((DisplayFrame) parent).getDisplayApplet().createRegion(Integer.parseInt(row), Integer.parseInt(column)); |
2 |
26 Feb 07 |
jari |
103 |
Hashtable hash = new Hashtable(); |
2 |
26 Feb 07 |
jari |
104 |
hash.put(new String("row"), row); |
2 |
26 Feb 07 |
jari |
105 |
hash.put(new String("column"), column); |
2 |
26 Feb 07 |
jari |
106 |
fireEvent(new ActionInfoEvent(this, hash)); |
2 |
26 Feb 07 |
jari |
107 |
|
2 |
26 Feb 07 |
jari |
108 |
dispose(); |
2 |
26 Feb 07 |
jari |
109 |
} |
2 |
26 Feb 07 |
jari |
110 |
} |
2 |
26 Feb 07 |
jari |
111 |
|
2 |
26 Feb 07 |
jari |
112 |
public void keyReleased(KeyEvent event) {;} |
2 |
26 Feb 07 |
jari |
113 |
public void keyTyped(KeyEvent event) {;} |
2 |
26 Feb 07 |
jari |
114 |
} |
2 |
26 Feb 07 |
jari |
115 |
} |