Inheritance diagram for AddNodeDialog::
Public Methods | |
AddNodeDialog (ActionListener action_listener) | |
void | actionPerformed (ActionEvent event) |
Private Attributes | |
ActionListener | action_listener |
Dialog | add_node |
Button | button_ok |
Button | button_cancel |
TextField | node_field |
String | node_name |
Frame | dummy |
Definition at line 862 of file Simulation.java.
|
Default constructor. Reference to network panel is required.
Definition at line 891 of file Simulation.java. 00892 { 00893 this.action_listener = action_listener; 00894 00895 dummy = new Frame(); 00896 add_node = new Dialog(dummy, "Dodaj \u010dvor"); 00897 button_ok = new Button("U redu"); 00898 button_cancel = new Button("Odustani"); 00899 node_field = new TextField("ime", 30); 00900 00901 Label node_label = new Label("Ime \u010dvora", Label.RIGHT); 00902 00903 add_node.setLayout(new BorderLayout()); 00904 add_node.setLayout(new GridLayout(2,2)); 00905 add_node.add(node_label); 00906 add_node.add(node_field); 00907 add_node.add(button_ok); 00908 add_node.add(button_cancel); 00909 00910 node_field.addActionListener(this); 00911 button_ok.addActionListener(this); 00912 button_cancel.addActionListener(this); 00913 00914 add_node.pack(); 00915 add_node.setResizable(false); 00916 add_node.show(); 00917 } |
|
Action handler. Wait for OK or Cancel button and then reads input and terminates dialog. Definition at line 923 of file Simulation.java. 00924 { 00925 Object source = event.getSource(); 00926 00927 /* node_field event */ 00928 if (source == node_field) 00929 { 00930 node_name = node_field.getText(); 00931 } 00932 /* button_ok event */ 00933 if (source == button_ok) 00934 { 00935 node_name = node_field.getText(); 00936 add_node.dispose(); 00937 action_listener.actionPerformed(new ActionEvent(this, 1, "OK")); 00938 } 00939 /* button_cancel event */ 00940 if (source == button_cancel) 00941 { 00942 add_node.dispose(); 00943 action_listener.actionPerformed(new ActionEvent(this, 0, "Cancel")); 00944 } 00945 } |
|
Action listener. Definition at line 867 of file Simulation.java. |
|
Add node dialog box. Definition at line 870 of file Simulation.java. |
|
Add node Cancel button. Definition at line 876 of file Simulation.java. |
|
Add node OK button. Definition at line 873 of file Simulation.java. |
|
Dummy frame required to aviod null-parent exception. Definition at line 885 of file Simulation.java. |
|
Node name field. Definition at line 879 of file Simulation.java. |
|
Node name. Definition at line 882 of file Simulation.java. |