package jalview.appletgui;\r
\r
import java.awt.*;\r
-import java.awt.event.*;\r
\r
-public class EditNameDialog\r
- extends Dialog implements ActionListener\r
+\r
+public class EditNameDialog extends JVDialog\r
{\r
TextField id, description;\r
- Button ok = new Button("Accept");\r
- Button cancel = new Button("Cancel");\r
- boolean accept = false;\r
\r
public String getName()\r
{\r
String desc,\r
String label1,\r
String label2,\r
- AlignmentPanel ap,\r
- String title)\r
+ Frame owner,\r
+ String title,\r
+ int width, int height)\r
{\r
- super(ap.alignFrame, title, true);\r
+ super(owner, title, true, width, height);\r
\r
- id = new TextField(name, 40);\r
- description = new TextField(desc, 40);\r
Panel panel = new Panel(new BorderLayout());\r
Panel panel2 = new Panel(new BorderLayout());\r
+\r
+ id = new TextField(name, 40);\r
Label label = new Label(label1);\r
label.setFont(new Font("Monospaced", Font.PLAIN, 12));\r
+\r
panel2.add(label, BorderLayout.WEST);\r
panel2.add(id, BorderLayout.CENTER);\r
panel.add(panel2, BorderLayout.NORTH);\r
- panel2 = new Panel(new BorderLayout());\r
- label = new Label(label2);\r
- label.setFont(new Font("Monospaced", Font.PLAIN, 12));\r
- panel2.add(label, BorderLayout.WEST);\r
- panel2.add(description, BorderLayout.CENTER);\r
- panel.add(panel2, BorderLayout.CENTER);\r
-\r
- panel2 = new Panel(new FlowLayout());\r
-\r
- panel2.add(ok);\r
- panel2.add(cancel);\r
- ok.addActionListener(this);\r
- cancel.addActionListener(this);\r
-\r
- panel.add(panel2, BorderLayout.SOUTH);\r
\r
- add(panel, BorderLayout.NORTH);\r
\r
- int width = 500, height = 100;\r
-\r
- pack();\r
-\r
- height += getInsets().top + getInsets().bottom;\r
-\r
- setBounds(ap.alignFrame.getBounds().x\r
- + (ap.alignFrame.getSize().width - width) / 2,\r
- ap.alignFrame.getBounds().y\r
- + (ap.alignFrame.getSize().height - height) / 2,\r
- width, height);\r
-\r
- show();\r
-\r
- }\r
-\r
- public void actionPerformed(ActionEvent evt)\r
- {\r
- if (evt.getSource() == ok)\r
+ if(label2!=null)\r
{\r
- accept = true;\r
+ panel2 = new Panel(new BorderLayout());\r
+ description = new TextField(desc, 40);\r
+ label = new Label(label2);\r
+ label.setFont(new Font("Monospaced", Font.PLAIN, 12));\r
+ panel2.add(label, BorderLayout.WEST);\r
+ panel2.add(description, BorderLayout.CENTER);\r
+ panel.add(panel2, BorderLayout.CENTER);\r
}\r
-\r
- setVisible(false);\r
+ setMainPanel(panel);\r
+ setVisible(true);\r
}\r
}\r