2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
20 package jalview.gui;
\r
23 import javax.swing.*;
\r
25 public class EditNameDialog
\r
27 JTextField id, description;
\r
28 JButton ok = new JButton("Accept");
\r
29 JButton cancel = new JButton("Cancel");
\r
30 boolean accept = false;
\r
32 public String getName()
\r
34 return id.getText();
\r
37 public String getDescription()
\r
39 if (description.getText().length() < 1)
\r
45 return description.getText();
\r
49 public EditNameDialog(String name,
\r
55 JLabel idlabel = new JLabel(label1);
\r
56 JLabel desclabel = new JLabel(label2);
\r
57 idlabel.setFont(new Font("Courier", Font.PLAIN, 12));
\r
58 desclabel.setFont(new Font("Courier", Font.PLAIN, 12));
\r
59 id = new JTextField(name, 40);
\r
60 description = new JTextField(desc, 40);
\r
61 JPanel panel = new JPanel(new BorderLayout());
\r
62 JPanel panel2 = new JPanel(new BorderLayout());
\r
63 panel2.add(idlabel, BorderLayout.WEST);
\r
64 panel2.add(id, BorderLayout.CENTER);
\r
65 panel.add(panel2, BorderLayout.NORTH);
\r
66 if(desc!=null || label2!=null)
\r
68 panel2 = new JPanel(new BorderLayout());
\r
69 panel2.add(desclabel, BorderLayout.WEST);
\r
70 panel2.add(description, BorderLayout.CENTER);
\r
71 panel.add(panel2, BorderLayout.SOUTH);
\r
74 int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
\r
76 JOptionPane.OK_CANCEL_OPTION);
\r
78 if (reply == JOptionPane.OK_OPTION)
\r