Remove edit menu if no group defined
[jalview.git] / src / jalview / jbgui / GUserDefinedColours.java
1 /*\r
2 * Jalview - A Sequence Alignment Editor and Viewer\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
4 *\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
9 *\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
14 *\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
18 */\r
19 package jalview.jbgui;\r
20 \r
21 import java.awt.*;\r
22 import java.awt.event.*;\r
23 \r
24 import javax.swing.*;\r
25 \r
26 \r
27 /**\r
28  * DOCUMENT ME!\r
29  *\r
30  * @author $author$\r
31  * @version $Revision$\r
32  */\r
33 public class GUserDefinedColours extends JPanel\r
34 {\r
35     protected JColorChooser colorChooser = new JColorChooser();\r
36     protected JPanel buttonPanel = new JPanel();\r
37     protected GridLayout gridLayout = new GridLayout();\r
38     JPanel jPanel2 = new JPanel();\r
39     protected JButton okButton = new JButton();\r
40     protected JButton applyButton = new JButton();\r
41     protected JButton loadbutton = new JButton();\r
42     protected JButton savebutton = new JButton();\r
43     protected JButton cancelButton = new JButton();\r
44   JPanel namePanel = new JPanel();\r
45   JLabel jLabel1 = new JLabel();\r
46   protected JTextField schemeName = new JTextField();\r
47   BorderLayout borderLayout1 = new BorderLayout();\r
48   JPanel panel1 = new JPanel();\r
49   JPanel jPanel1 = new JPanel();\r
50   JPanel jPanel3 = new JPanel();\r
51   BorderLayout borderLayout3 = new BorderLayout();\r
52   GridBagLayout gridBagLayout1 = new GridBagLayout();\r
53   BorderLayout borderLayout2 = new BorderLayout();\r
54   FlowLayout flowLayout1 = new FlowLayout();\r
55   BorderLayout borderLayout4 = new BorderLayout();\r
56   JPanel jPanel4 = new JPanel();\r
57   BorderLayout borderLayout5 = new BorderLayout();\r
58   JPanel jPanel6 = new JPanel();\r
59   JTextArea jTextArea1 = new JTextArea();\r
60   /**\r
61      * Creates a new GUserDefinedColours object.\r
62      */\r
63     public GUserDefinedColours()\r
64     {\r
65         try\r
66         {\r
67             jbInit();\r
68         }\r
69         catch (Exception e)\r
70         {\r
71             e.printStackTrace();\r
72         }\r
73     }\r
74 \r
75     /**\r
76      * DOCUMENT ME!\r
77      *\r
78      * @throws Exception DOCUMENT ME!\r
79      */\r
80     private void jbInit() throws Exception\r
81     {\r
82         this.setLayout(borderLayout4);\r
83         buttonPanel.setLayout(gridLayout);\r
84         gridLayout.setColumns(4);\r
85         gridLayout.setRows(6);\r
86         okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
87         okButton.setText("OK");\r
88         okButton.addActionListener(new java.awt.event.ActionListener()\r
89             {\r
90                 public void actionPerformed(ActionEvent e)\r
91                 {\r
92                     okButton_actionPerformed(e);\r
93                 }\r
94             });\r
95         applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
96         applyButton.setText("Apply");\r
97         applyButton.addActionListener(new java.awt.event.ActionListener()\r
98             {\r
99                 public void actionPerformed(ActionEvent e)\r
100                 {\r
101                     applyButton_actionPerformed(e);\r
102                 }\r
103             });\r
104         loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
105         loadbutton.setText("Load scheme");\r
106         loadbutton.addActionListener(new java.awt.event.ActionListener()\r
107             {\r
108                 public void actionPerformed(ActionEvent e)\r
109                 {\r
110                     loadbutton_actionPerformed(e);\r
111                 }\r
112             });\r
113         savebutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
114         savebutton.setText("Save scheme");\r
115         savebutton.addActionListener(new java.awt.event.ActionListener()\r
116             {\r
117                 public void actionPerformed(ActionEvent e)\r
118                 {\r
119                     savebutton_actionPerformed(e);\r
120                 }\r
121             });\r
122         cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
123         cancelButton.setText("Cancel");\r
124         cancelButton.addActionListener(new java.awt.event.ActionListener()\r
125             {\r
126                 public void actionPerformed(ActionEvent e)\r
127                 {\r
128                     cancelButton_actionPerformed(e);\r
129                 }\r
130             });\r
131         this.setBackground(new Color(212, 208, 223));\r
132         jPanel2.setOpaque(false);\r
133     jPanel2.setLayout(borderLayout3);\r
134     colorChooser.setOpaque(false);\r
135     jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
136     jLabel1.setText("Name");\r
137     namePanel.setMinimumSize(new Dimension(300, 31));\r
138     namePanel.setOpaque(false);\r
139     namePanel.setPreferredSize(new Dimension(240, 25));\r
140     namePanel.setToolTipText("");\r
141     namePanel.setLayout(borderLayout1);\r
142     schemeName.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
143     schemeName.setPreferredSize(new Dimension(105, 21));\r
144     schemeName.setText("");\r
145     schemeName.setHorizontalAlignment(SwingConstants.CENTER);\r
146     panel1.setLayout(flowLayout1);\r
147     panel1.setOpaque(false);\r
148     jPanel1.setOpaque(false);\r
149     jPanel3.setOpaque(false);\r
150     jPanel4.setLayout(borderLayout5);\r
151     jPanel6.setBackground(Color.pink);\r
152     jPanel6.setMinimumSize(new Dimension(10, 70));\r
153     jPanel6.setOpaque(false);\r
154     jPanel6.setPreferredSize(new Dimension(10, 45));\r
155     jPanel6.setLayout(null);\r
156     jTextArea1.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));\r
157     jTextArea1.setOpaque(false);\r
158     jTextArea1.setPreferredSize(new Dimension(260, 34));\r
159     jTextArea1.setText(\r
160         "Save your colour scheme with a unique name and it will be added " +\r
161         "to the Colour menu.");\r
162     jTextArea1.setLineWrap(true);\r
163     jTextArea1.setRows(2);\r
164     jTextArea1.setWrapStyleWord(true);\r
165     jPanel3.add(savebutton);\r
166     jPanel3.add(loadbutton);\r
167     jPanel1.add(applyButton);\r
168     jPanel1.add(okButton);\r
169     jPanel1.add(cancelButton);\r
170     jPanel2.add(jPanel3, java.awt.BorderLayout.NORTH);\r
171     jPanel2.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
172 \r
173     namePanel.add(schemeName, java.awt.BorderLayout.CENTER);\r
174     namePanel.add(jLabel1, java.awt.BorderLayout.WEST);\r
175     panel1.add(namePanel, null);\r
176     panel1.add(buttonPanel, null);\r
177     panel1.add(jPanel2, null);\r
178     panel1.add(jTextArea1);\r
179 \r
180     jPanel4.add(panel1, java.awt.BorderLayout.CENTER);\r
181     jPanel4.add(jPanel6, java.awt.BorderLayout.NORTH);\r
182     this.add(jPanel4, java.awt.BorderLayout.CENTER);\r
183     this.add(colorChooser, java.awt.BorderLayout.EAST);\r
184   }\r
185 \r
186     /**\r
187      * DOCUMENT ME!\r
188      *\r
189      * @param e DOCUMENT ME!\r
190      */\r
191     protected void okButton_actionPerformed(ActionEvent e)\r
192     {\r
193     }\r
194 \r
195     /**\r
196      * DOCUMENT ME!\r
197      *\r
198      * @param e DOCUMENT ME!\r
199      */\r
200     protected void applyButton_actionPerformed(ActionEvent e)\r
201     {\r
202     }\r
203 \r
204     /**\r
205      * DOCUMENT ME!\r
206      *\r
207      * @param e DOCUMENT ME!\r
208      */\r
209     protected void loadbutton_actionPerformed(ActionEvent e)\r
210     {\r
211     }\r
212 \r
213     /**\r
214      * DOCUMENT ME!\r
215      *\r
216      * @param e DOCUMENT ME!\r
217      */\r
218     protected void savebutton_actionPerformed(ActionEvent e)\r
219     {\r
220     }\r
221 \r
222     /**\r
223      * DOCUMENT ME!\r
224      *\r
225      * @param e DOCUMENT ME!\r
226      */\r
227     protected void cancelButton_actionPerformed(ActionEvent e)\r
228     {\r
229     }\r
230 }\r