Graphical bits moved into files to save jar size
[jalview.git] / src / jalview / jbgui / GFontChooser.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 GFontChooser extends JPanel\r
34 {\r
35     JLabel jLabel1 = new JLabel();\r
36     protected JComboBox fontSize = new JComboBox();\r
37     protected JComboBox fontStyle = new JComboBox();\r
38     JLabel jLabel2 = new JLabel();\r
39     JLabel jLabel3 = new JLabel();\r
40     protected JComboBox fontName = new JComboBox();\r
41     JButton ok = new JButton();\r
42     JButton cancel = new JButton();\r
43     JPanel jPanel1 = new JPanel();\r
44     JPanel jPanel2 = new JPanel();\r
45     JPanel jPanel3 = new JPanel();\r
46     BorderLayout borderLayout1 = new BorderLayout();\r
47     BorderLayout borderLayout2 = new BorderLayout();\r
48     BorderLayout borderLayout3 = new BorderLayout();\r
49     FlowLayout flowLayout1 = new FlowLayout();\r
50     protected JButton defaultButton = new JButton();\r
51 \r
52     /**\r
53      * Creates a new GFontChooser object.\r
54      */\r
55     public GFontChooser()\r
56     {\r
57         try\r
58         {\r
59             jbInit();\r
60         }\r
61         catch (Exception e)\r
62         {\r
63             e.printStackTrace();\r
64         }\r
65     }\r
66 \r
67     /**\r
68      * DOCUMENT ME!\r
69      *\r
70      * @throws Exception DOCUMENT ME!\r
71      */\r
72     private void jbInit() throws Exception\r
73     {\r
74         jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
75         jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
76         jLabel1.setText("Font: ");\r
77         jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
78         this.setLayout(flowLayout1);\r
79         fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
80         fontSize.setOpaque(false);\r
81         fontSize.setPreferredSize(new Dimension(50, 21));\r
82         fontSize.addActionListener(new java.awt.event.ActionListener()\r
83             {\r
84                 public void actionPerformed(ActionEvent e)\r
85                 {\r
86                     fontSize_actionPerformed(e);\r
87                 }\r
88             });\r
89         fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
90         fontStyle.setOpaque(false);\r
91         fontStyle.setPreferredSize(new Dimension(90, 21));\r
92         fontStyle.addActionListener(new java.awt.event.ActionListener()\r
93             {\r
94                 public void actionPerformed(ActionEvent e)\r
95                 {\r
96                     fontStyle_actionPerformed(e);\r
97                 }\r
98             });\r
99         jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));\r
100         jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
101         jLabel2.setText("Size: ");\r
102         jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
103         jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));\r
104         jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
105         jLabel3.setText("Style: ");\r
106         jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
107         fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
108         fontName.setMaximumSize(new Dimension(32767, 32767));\r
109         fontName.setMinimumSize(new Dimension(300, 21));\r
110         fontName.setOpaque(false);\r
111         fontName.setPreferredSize(new Dimension(180, 21));\r
112         fontName.addActionListener(new java.awt.event.ActionListener()\r
113             {\r
114                 public void actionPerformed(ActionEvent e)\r
115                 {\r
116                     fontName_actionPerformed(e);\r
117                 }\r
118             });\r
119         ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
120         ok.setText("OK");\r
121         ok.addActionListener(new java.awt.event.ActionListener()\r
122             {\r
123                 public void actionPerformed(ActionEvent e)\r
124                 {\r
125                     ok_actionPerformed(e);\r
126                 }\r
127             });\r
128         cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
129         cancel.setText("Cancel");\r
130         cancel.addActionListener(new java.awt.event.ActionListener()\r
131             {\r
132                 public void actionPerformed(ActionEvent e)\r
133                 {\r
134                     cancel_actionPerformed(e);\r
135                 }\r
136             });\r
137         this.setBackground(Color.white);\r
138         jPanel1.setOpaque(false);\r
139         jPanel1.setLayout(borderLayout1);\r
140         jPanel2.setOpaque(false);\r
141         jPanel2.setLayout(borderLayout3);\r
142         jPanel3.setOpaque(false);\r
143         jPanel3.setLayout(borderLayout2);\r
144         flowLayout1.setAlignment(FlowLayout.CENTER);\r
145         flowLayout1.setVgap(5);\r
146         defaultButton.setText("Set as Default");\r
147         defaultButton.addActionListener(new ActionListener()\r
148             {\r
149                 public void actionPerformed(ActionEvent e)\r
150                 {\r
151                     defaultButton_actionPerformed(e);\r
152                 }\r
153             });\r
154         this.add(jPanel1, null);\r
155         jPanel1.add(jLabel1, BorderLayout.WEST);\r
156         jPanel1.add(fontName, BorderLayout.CENTER);\r
157         this.add(jPanel3, null);\r
158         this.add(jPanel2, null);\r
159         jPanel2.add(jLabel3, BorderLayout.WEST);\r
160         jPanel2.add(fontStyle, BorderLayout.CENTER);\r
161         jPanel3.add(jLabel2, BorderLayout.WEST);\r
162         jPanel3.add(fontSize, BorderLayout.CENTER);\r
163         this.add(ok, null);\r
164         this.add(cancel, null);\r
165         this.add(defaultButton);\r
166     }\r
167 \r
168     /**\r
169      * DOCUMENT ME!\r
170      *\r
171      * @param e DOCUMENT ME!\r
172      */\r
173     protected void ok_actionPerformed(ActionEvent e)\r
174     {\r
175     }\r
176 \r
177     /**\r
178      * DOCUMENT ME!\r
179      *\r
180      * @param e DOCUMENT ME!\r
181      */\r
182     protected void cancel_actionPerformed(ActionEvent e)\r
183     {\r
184     }\r
185 \r
186     /**\r
187      * DOCUMENT ME!\r
188      *\r
189      * @param e DOCUMENT ME!\r
190      */\r
191     protected void fontName_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 fontSize_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 fontStyle_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     public void defaultButton_actionPerformed(ActionEvent e)\r
219     {\r
220     }\r
221 }\r