Inheritance diagram for DeleteNodeDialog::
Public Methods | |
DeleteNodeDialog (ActionListener action_listener) | |
void | actionPerformed (ActionEvent event) |
Private Attributes | |
ActionListener | action_listener |
Dialog | delete_node |
Button | button_ok |
Button | button_cancel |
TextField | node_field |
String | node_name |
Frame | dummy |
Definition at line 1069 of file Simulation.java.
|
Default constructor. Reference to network panel is required.
Definition at line 1098 of file Simulation.java. 01099 { 01100 this.action_listener = action_listener; 01101 01102 dummy = new Frame(); 01103 delete_node = new Dialog(dummy, "Obri\u0161i \u010dvor"); 01104 button_ok = new Button("U redu"); 01105 button_cancel = new Button("Odustani"); 01106 node_field = new TextField("ime", 30); 01107 01108 Label node_label = new Label("Ime \u010dvora", Label.RIGHT); 01109 01110 delete_node.setLayout(new BorderLayout()); 01111 delete_node.setLayout(new GridLayout(2,2)); 01112 delete_node.add(node_label); 01113 delete_node.add(node_field); 01114 delete_node.add(button_ok); 01115 delete_node.add(button_cancel); 01116 01117 node_field.addActionListener(this); 01118 button_ok.addActionListener(this); 01119 button_cancel.addActionListener(this); 01120 01121 delete_node.pack(); 01122 delete_node.setResizable(false); 01123 delete_node.show(); 01124 } |
|
Action handler. Wait for OK or Cancel button and then reads input and terminates dialog. Definition at line 1130 of file Simulation.java. 01131 { 01132 Object source = event.getSource(); 01133 01134 /* node_field event */ 01135 if (source == node_field) 01136 { 01137 node_name = node_field.getText(); 01138 } 01139 /* button_ok event */ 01140 if (source == button_ok) 01141 { 01142 node_name = node_field.getText(); 01143 delete_node.dispose(); 01144 action_listener.actionPerformed(new ActionEvent(this, 1, "OK")); 01145 } 01146 /* button_cancel event */ 01147 if (source == button_cancel) 01148 { 01149 delete_node.dispose(); 01150 action_listener.actionPerformed(new ActionEvent(this, 0, "Cancel")); 01151 } 01152 } |
|
Action listener. Definition at line 1074 of file Simulation.java. |
|
Add node Cancel button. Definition at line 1083 of file Simulation.java. |
|
Add node OK button. Definition at line 1080 of file Simulation.java. |
|
Add node dialog box. Definition at line 1077 of file Simulation.java. |
|
Dummy frame required to aviod null-parent exception. Definition at line 1092 of file Simulation.java. |
|
Node name field. Definition at line 1086 of file Simulation.java. |
|
Node name. Definition at line 1089 of file Simulation.java. |