Source code: alice/tucson/ide/InspectorSpawner.java
1 /*
2 * InspectorSpawner.java
3 *
4 * Created on 27 novembre 2000, 18.00
5 */
6
7 package alice.tucson.ide;
8
9 /**
10 *
11 * @author Administrator
12 * @version
13 */
14 public class InspectorSpawner extends javax.swing.JFrame {
15
16 /** Creates new form InspectorSpawner */
17 public InspectorSpawner() {
18 initComponents ();
19 pack ();
20 inputName.setText("default");
21 inputAddress.setText("localhost");
22 }
23
24 /** This method is called from within the constructor to
25 * initialize the form.
26 * WARNING: Do NOT modify this code. The content of this method is
27 * always regenerated by the FormEditor.
28 */
29 private void initComponents() {//GEN-BEGIN:initComponents
30 jPanel1 = new javax.swing.JPanel();
31 inputName = new javax.swing.JTextField();
32 jLabel5 = new javax.swing.JLabel();
33 address = new javax.swing.JLabel();
34 inputAddress = new javax.swing.JTextField();
35 buttonInspect = new javax.swing.JButton();
36 outputStatus = new javax.swing.JTextField();
37 jLabel1 = new javax.swing.JLabel();
38 getContentPane().setLayout(new java.awt.GridBagLayout());
39 java.awt.GridBagConstraints gridBagConstraints1;
40 setTitle("TuCSoN inspector spawner");
41 setResizable(false);
42 addWindowListener(new java.awt.event.WindowAdapter() {
43 public void windowClosing(java.awt.event.WindowEvent evt) {
44 exitForm(evt);
45 }
46 }
47 );
48
49 jPanel1.setLayout(new java.awt.GridBagLayout());
50 java.awt.GridBagConstraints gridBagConstraints2;
51 jPanel1.setBorder(new javax.swing.border.TitledBorder("tuple centre to inspect"));
52
53 inputName.setFont(new java.awt.Font ("Courier New", 0, 12));
54 gridBagConstraints2 = new java.awt.GridBagConstraints();
55 gridBagConstraints2.gridx = 1;
56 gridBagConstraints2.gridy = 0;
57 gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
58 gridBagConstraints2.weightx = 40.0;
59 gridBagConstraints2.weighty = 30.0;
60 jPanel1.add(inputName, gridBagConstraints2);
61
62
63 jLabel5.setText("name");
64 jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
65 jLabel5.setFont(new java.awt.Font ("Arial", 0, 11));
66 gridBagConstraints2 = new java.awt.GridBagConstraints();
67 gridBagConstraints2.gridx = 0;
68 gridBagConstraints2.gridy = 0;
69 gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
70 gridBagConstraints2.weightx = 5.0;
71 jPanel1.add(jLabel5, gridBagConstraints2);
72
73
74 address.setText("address");
75 address.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
76 address.setFont(new java.awt.Font ("Arial", 0, 11));
77 gridBagConstraints2 = new java.awt.GridBagConstraints();
78 gridBagConstraints2.gridx = 0;
79 gridBagConstraints2.gridy = 1;
80 gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
81 gridBagConstraints2.weightx = 5.0;
82 jPanel1.add(address, gridBagConstraints2);
83
84
85 inputAddress.setFont(new java.awt.Font ("Courier New", 0, 12));
86 gridBagConstraints2 = new java.awt.GridBagConstraints();
87 gridBagConstraints2.gridx = 1;
88 gridBagConstraints2.gridy = 1;
89 gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;
90 gridBagConstraints2.weightx = 40.0;
91 gridBagConstraints2.weighty = 30.0;
92 jPanel1.add(inputAddress, gridBagConstraints2);
93
94
95 buttonInspect.setFont(new java.awt.Font ("Arial", 0, 11));
96 buttonInspect.setText("inspect");
97 buttonInspect.addActionListener(new java.awt.event.ActionListener() {
98 public void actionPerformed(java.awt.event.ActionEvent evt) {
99 buttonInspectActionPerformed(evt);
100 }
101 }
102 );
103 gridBagConstraints2 = new java.awt.GridBagConstraints();
104 gridBagConstraints2.gridx = 0;
105 gridBagConstraints2.gridy = 2;
106 gridBagConstraints2.gridwidth = 2;
107 gridBagConstraints2.weightx = 100.0;
108 gridBagConstraints2.weighty = 30.0;
109 jPanel1.add(buttonInspect, gridBagConstraints2);
110
111
112 gridBagConstraints1 = new java.awt.GridBagConstraints();
113 gridBagConstraints1.gridx = 1;
114 gridBagConstraints1.gridy = 1;
115 gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
116 gridBagConstraints1.weightx = 100.0;
117 gridBagConstraints1.weighty = 100.0;
118 getContentPane().add(jPanel1, gridBagConstraints1);
119
120
121 outputStatus.setBorder(new javax.swing.border.SoftBevelBorder(1));
122 outputStatus.setEditable(false);
123 outputStatus.setBackground(java.awt.Color.lightGray);
124
125 gridBagConstraints1 = new java.awt.GridBagConstraints();
126 gridBagConstraints1.gridx = 0;
127 gridBagConstraints1.gridy = 2;
128 gridBagConstraints1.gridwidth = 2;
129 gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
130 getContentPane().add(outputStatus, gridBagConstraints1);
131
132
133 jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/alice/tucson/ide/logo.GIF")));
134 jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
135
136 gridBagConstraints1 = new java.awt.GridBagConstraints();
137 gridBagConstraints1.gridx = 0;
138 gridBagConstraints1.gridy = 1;
139 gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH;
140 getContentPane().add(jLabel1, gridBagConstraints1);
141
142 }//GEN-END:initComponents
143
144 private void buttonInspectActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonInspectActionPerformed
145 String name=inputName.getText();
146 String address=inputAddress.getText();
147
148 if (name.equals("")){
149 name="default";
150 inputName.setText(name);
151 }
152
153 if (address.equals("")){
154 address="localhost";
155 inputAddress.setText(address);
156 }
157
158 try {
159 InspectorAgent inspectorForm=new InspectorAgent(new String[]{ name, address});
160 inspectorForm.setSize(300,240);
161 inspectorForm.show ();
162 outputStatus.setText("ok");
163 } catch (Exception ex){
164 outputStatus.setText(ex.toString());
165 }
166
167 }//GEN-LAST:event_buttonInspectActionPerformed
168
169 /** Exit the Application */
170 private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
171 this.dispose();
172 System.exit (0);
173 }//GEN-LAST:event_exitForm
174
175 /**
176 * @param args the command line arguments
177 */
178 public static void main (String args[]) {
179 InspectorSpawner form=new InspectorSpawner ();
180 form.setSize(380,210);
181 form.show ();
182 }
183
184
185 // Variables declaration - do not modify//GEN-BEGIN:variables
186 private javax.swing.JPanel jPanel1;
187 private javax.swing.JTextField inputName;
188 private javax.swing.JLabel jLabel5;
189 private javax.swing.JLabel address;
190 private javax.swing.JTextField inputAddress;
191 private javax.swing.JButton buttonInspect;
192 private javax.swing.JTextField outputStatus;
193 private javax.swing.JLabel jLabel1;
194 // End of variables declaration//GEN-END:variables
195
196 }