update author list in license for (JAL-826)
[jalview.git] / src / jalview / appletgui / EditNameDialog.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
4  * 
5  * This file is part of Jalview.
6  * 
7  * Jalview is free software: you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License 
9  * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
10  * 
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 package jalview.appletgui;
19
20 import java.awt.*;
21
22 public class EditNameDialog extends JVDialog
23 {
24   TextField id, description;
25
26   public String getName()
27   {
28     return id.getText();
29   }
30
31   public String getDescription()
32   {
33     if (description.getText().length() < 1)
34     {
35       return null;
36     }
37     else
38     {
39       return description.getText();
40     }
41   }
42
43   public EditNameDialog(String name, String desc, String label1,
44           String label2, Frame owner, String title, int width, int height,
45           boolean display)
46   {
47     super(owner, title, true, width, height);
48
49     Font mono = new Font("Monospaced", Font.PLAIN, 12);
50     Panel panel = new Panel(new BorderLayout());
51     Panel panel2 = new Panel(new BorderLayout());
52
53     id = new TextField(name, 40);
54     id.setFont(mono);
55     Label label = new Label(label1);
56     label.setFont(mono);
57
58     panel2.add(label, BorderLayout.WEST);
59     panel2.add(id, BorderLayout.CENTER);
60     panel.add(panel2, BorderLayout.NORTH);
61
62     if (label2 != null)
63     {
64       panel2 = new Panel(new BorderLayout());
65       description = new TextField(desc, 40);
66       description.setFont(mono);
67       label = new Label(label2);
68       label.setFont(mono);
69       panel2.add(label, BorderLayout.WEST);
70       panel2.add(description, BorderLayout.CENTER);
71       panel.add(panel2, BorderLayout.CENTER);
72     }
73     setMainPanel(panel);
74     setVisible(display);
75   }
76 }