elementAt instead of get for 1.1 compatibility
[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   JLabel label = new JLabel();\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     label.setFont(new java.awt.Font("Verdana", Font.ITALIC, 10));\r
157     label.setOpaque(false);\r
158     label.setPreferredSize(new Dimension(260, 34));\r
159     label.setText(\r
160         "<html>Save your colour scheme with a unique name and it will be added " +\r
161         "to the Colour menu.</html>");\r
162 \r
163     jPanel3.add(savebutton);\r
164     jPanel3.add(loadbutton);\r
165     jPanel1.add(applyButton);\r
166     jPanel1.add(okButton);\r
167     jPanel1.add(cancelButton);\r
168     jPanel2.add(jPanel3, java.awt.BorderLayout.NORTH);\r
169     jPanel2.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
170 \r
171     namePanel.add(schemeName, java.awt.BorderLayout.CENTER);\r
172     namePanel.add(jLabel1, java.awt.BorderLayout.WEST);\r
173     panel1.add(namePanel, null);\r
174     panel1.add(buttonPanel, null);\r
175     panel1.add(jPanel2, null);\r
176     panel1.add(label);\r
177 \r
178     jPanel4.add(panel1, java.awt.BorderLayout.CENTER);\r
179     jPanel4.add(jPanel6, java.awt.BorderLayout.NORTH);\r
180     this.add(jPanel4, java.awt.BorderLayout.CENTER);\r
181     this.add(colorChooser, java.awt.BorderLayout.EAST);\r
182   }\r
183 \r
184     /**\r
185      * DOCUMENT ME!\r
186      *\r
187      * @param e DOCUMENT ME!\r
188      */\r
189     protected void okButton_actionPerformed(ActionEvent e)\r
190     {\r
191     }\r
192 \r
193     /**\r
194      * DOCUMENT ME!\r
195      *\r
196      * @param e DOCUMENT ME!\r
197      */\r
198     protected void applyButton_actionPerformed(ActionEvent e)\r
199     {\r
200     }\r
201 \r
202     /**\r
203      * DOCUMENT ME!\r
204      *\r
205      * @param e DOCUMENT ME!\r
206      */\r
207     protected void loadbutton_actionPerformed(ActionEvent e)\r
208     {\r
209     }\r
210 \r
211     /**\r
212      * DOCUMENT ME!\r
213      *\r
214      * @param e DOCUMENT ME!\r
215      */\r
216     protected void savebutton_actionPerformed(ActionEvent e)\r
217     {\r
218     }\r
219 \r
220     /**\r
221      * DOCUMENT ME!\r
222      *\r
223      * @param e DOCUMENT ME!\r
224      */\r
225     protected void cancelButton_actionPerformed(ActionEvent e)\r
226     {\r
227     }\r
228 }\r