Inheritance diagram for TracerouteDialog::
Public Methods | |
TracerouteDialog (ActionListener action_listener) | |
void | actionPerformed (ActionEvent event) |
Private Attributes | |
ActionListener | action_listener |
Dialog | traceroute |
Button | button_ok |
Button | button_cancel |
TextField | left_field |
String | left_name |
TextField | right_field |
String | right_name |
Frame | dummy |
Definition at line 1164 of file Simulation.java.
|
Default constructor. Reference to network panel is required.
Definition at line 1199 of file Simulation.java. 01200 { 01201 this.action_listener = action_listener; 01202 01203 dummy = new Frame(); 01204 traceroute = new Dialog(dummy, "Pra\u0107enje paketa"); 01205 button_ok = new Button("U redu"); 01206 button_cancel = new Button("Odustani"); 01207 left_field = new TextField("ime", 30); 01208 right_field = new TextField("ime", 30); 01209 01210 Label left_label = new Label("Po\u010detni \u010dvor", Label.RIGHT); 01211 Label right_label = new Label("Kona\u010dni \u010dvor", Label.RIGHT); 01212 01213 traceroute.setLayout(new BorderLayout()); 01214 traceroute.setLayout(new GridLayout(3,2)); 01215 traceroute.add(left_label); 01216 traceroute.add(left_field); 01217 traceroute.add(right_label); 01218 traceroute.add(right_field); 01219 traceroute.add(button_ok); 01220 traceroute.add(button_cancel); 01221 01222 right_field.addActionListener(this); 01223 left_field.addActionListener(this); 01224 button_ok.addActionListener(this); 01225 button_cancel.addActionListener(this); 01226 01227 traceroute.pack(); 01228 traceroute.setResizable(false); 01229 traceroute.show(); 01230 } |
|
Action handler. Wait for OK or Cancel button and then reads input and terminates dialog. Definition at line 1236 of file Simulation.java. 01237 { 01238 Object source = event.getSource(); 01239 01240 /* left_field event */ 01241 if (source == left_field) 01242 { 01243 left_name = left_field.getText(); 01244 } 01245 /* right_field event */ 01246 if (source == right_field) 01247 { 01248 right_name = right_field.getText(); 01249 } 01250 /* capacity event */ 01251 if (source == button_ok) 01252 { 01253 left_name = left_field.getText(); 01254 right_name = right_field.getText(); 01255 traceroute.dispose(); 01256 action_listener.actionPerformed(new ActionEvent(this, 1, "OK")); 01257 } 01258 /* button_cancel event */ 01259 if (source == button_cancel) 01260 { 01261 traceroute.dispose(); 01262 action_listener.actionPerformed(new ActionEvent(this, 0, "Cancel")); 01263 } 01264 } |
|
Action listener. Definition at line 1169 of file Simulation.java. |
|
Traceroute Cancel button. Definition at line 1178 of file Simulation.java. |
|
Traceroute OK button. Definition at line 1175 of file Simulation.java. |
|
Dummy frame required to aviod null-parent exception. Definition at line 1193 of file Simulation.java. |
|
Left node name field. Definition at line 1181 of file Simulation.java. |
|
Left node name. Definition at line 1184 of file Simulation.java. |
|
Right node name field. Definition at line 1187 of file Simulation.java. |
|
Right node name. Definition at line 1190 of file Simulation.java. |
|
Traceroute dialog box. Definition at line 1172 of file Simulation.java. |