Inheritance diagram for DeleteLineDialog::
Public Methods | |
DeleteLineDialog (ActionListener action_listener) | |
void | actionPerformed (ActionEvent event) |
Private Attributes | |
ActionListener | action_listener |
Dialog | delete_line |
Button | button_ok |
Button | button_cancel |
TextField | left_field |
String | left_name |
TextField | right_field |
String | right_name |
Frame | dummy |
Definition at line 957 of file Simulation.java.
|
Default constructor. Reference to network panel is required.
Definition at line 992 of file Simulation.java. 00993 { 00994 this.action_listener = action_listener; 00995 00996 dummy = new Frame(); 00997 delete_line = new Dialog(dummy, "Obri\u0161i liniju"); 00998 button_ok = new Button("U redu"); 00999 button_cancel = new Button("Odustani"); 01000 left_field = new TextField("ime", 30); 01001 right_field = new TextField("ime", 30); 01002 01003 Label left_label = new Label("Lijevi \u010dvor", Label.RIGHT); 01004 Label right_label = new Label("Desni \u010dvor", Label.RIGHT); 01005 01006 delete_line.setLayout(new BorderLayout()); 01007 delete_line.setLayout(new GridLayout(3,2)); 01008 delete_line.add(left_label); 01009 delete_line.add(left_field); 01010 delete_line.add(right_label); 01011 delete_line.add(right_field); 01012 delete_line.add(button_ok); 01013 delete_line.add(button_cancel); 01014 01015 right_field.addActionListener(this); 01016 left_field.addActionListener(this); 01017 button_ok.addActionListener(this); 01018 button_cancel.addActionListener(this); 01019 01020 delete_line.pack(); 01021 delete_line.setResizable(false); 01022 delete_line.show(); 01023 } |
|
Action handler. Wait for OK or Cancel button and then reads input and terminates dialog. Definition at line 1029 of file Simulation.java. 01030 { 01031 Object source = event.getSource(); 01032 01033 /* left_field event */ 01034 if (source == left_field) 01035 { 01036 left_name = left_field.getText(); 01037 } 01038 /* right_field event */ 01039 if (source == right_field) 01040 { 01041 right_name = right_field.getText(); 01042 } 01043 /* capacity event */ 01044 if (source == button_ok) 01045 { 01046 left_name = left_field.getText(); 01047 right_name = right_field.getText(); 01048 delete_line.dispose(); 01049 action_listener.actionPerformed(new ActionEvent(this, 1, "OK")); 01050 } 01051 /* button_cancel event */ 01052 if (source == button_cancel) 01053 { 01054 delete_line.dispose(); 01055 action_listener.actionPerformed(new ActionEvent(this, 0, "Cancel")); 01056 } 01057 } |
|
Action listener. Definition at line 962 of file Simulation.java. |
|
Add line Cancel button. Definition at line 971 of file Simulation.java. |
|
Add line OK button. Definition at line 968 of file Simulation.java. |
|
Add line dialog box. Definition at line 965 of file Simulation.java. |
|
Dummy frame required to aviod null-parent exception. Definition at line 986 of file Simulation.java. |
|
Left node name field. Definition at line 974 of file Simulation.java. |
|
Left node name. Definition at line 977 of file Simulation.java. |
|
Right node name field. Definition at line 980 of file Simulation.java. |
|
Right node name. Definition at line 983 of file Simulation.java. |