dda5aebd39a37ec509429f76b70cbe3b4d0dbcc7
[jalview.git] / src / jalview / jbgui / GFontChooser.java
1 /*\r
2 * Jalview - A Sequence Alignment Editor and Viewer\r
3 * Copyright (C) 2006 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 import java.awt.BorderLayout;\r
26 import java.awt.Font;\r
27 import java.awt.Rectangle;\r
28 \r
29 /**\r
30  * DOCUMENT ME!\r
31  *\r
32  * @author $author$\r
33  * @version $Revision$\r
34  */\r
35 public class GFontChooser extends JPanel\r
36 {\r
37     JLabel jLabel1 = new JLabel();\r
38     protected JComboBox fontSize = new JComboBox();\r
39     protected JComboBox fontStyle = new JComboBox();\r
40     JLabel jLabel2 = new JLabel();\r
41     JLabel jLabel3 = new JLabel();\r
42     protected JComboBox fontName = new JComboBox();\r
43     JButton ok = new JButton();\r
44     JButton cancel = new JButton();\r
45     JPanel jPanel1 = new JPanel();\r
46     JPanel jPanel2 = new JPanel();\r
47     JPanel jPanel3 = new JPanel();\r
48     BorderLayout borderLayout1 = new BorderLayout();\r
49     BorderLayout borderLayout2 = new BorderLayout();\r
50     BorderLayout borderLayout3 = new BorderLayout();\r
51   protected JButton defaultButton = new JButton();\r
52    protected  JCheckBox smoothFont = new JCheckBox();\r
53   BorderLayout borderLayout4 = new BorderLayout();\r
54  protected JCheckBox monospaced = new JCheckBox();\r
55   JPanel jPanel4 = new JPanel();\r
56 \r
57   /**\r
58      * Creates a new GFontChooser object.\r
59      */\r
60     public GFontChooser()\r
61     {\r
62         try\r
63         {\r
64             jbInit();\r
65         }\r
66         catch (Exception e)\r
67         {\r
68             e.printStackTrace();\r
69         }\r
70     }\r
71 \r
72     /**\r
73      * DOCUMENT ME!\r
74      *\r
75      * @throws Exception DOCUMENT ME!\r
76      */\r
77     private void jbInit() throws Exception\r
78     {\r
79         jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
80         jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
81         jLabel1.setText("Font: ");\r
82         jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
83         this.setLayout(null);\r
84         fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
85         fontSize.setOpaque(false);\r
86         fontSize.setPreferredSize(new Dimension(50, 21));\r
87     fontSize.addActionListener(new java.awt.event.ActionListener()\r
88             {\r
89                 public void actionPerformed(ActionEvent e)\r
90                 {\r
91                     fontSize_actionPerformed(e);\r
92                 }\r
93             });\r
94         fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
95         fontStyle.setOpaque(false);\r
96         fontStyle.setPreferredSize(new Dimension(90, 21));\r
97     fontStyle.addActionListener(new java.awt.event.ActionListener()\r
98             {\r
99                 public void actionPerformed(ActionEvent e)\r
100                 {\r
101                     fontStyle_actionPerformed(e);\r
102                 }\r
103             });\r
104         jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));\r
105         jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
106         jLabel2.setText("Size: ");\r
107         jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
108     jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));\r
109         jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
110         jLabel3.setText("Style: ");\r
111         jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
112     fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
113         fontName.setMaximumSize(new Dimension(32767, 32767));\r
114         fontName.setMinimumSize(new Dimension(300, 21));\r
115         fontName.setOpaque(false);\r
116         fontName.setPreferredSize(new Dimension(180, 21));\r
117         fontName.addActionListener(new java.awt.event.ActionListener()\r
118             {\r
119                 public void actionPerformed(ActionEvent e)\r
120                 {\r
121                     fontName_actionPerformed(e);\r
122                 }\r
123             });\r
124     ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
125         ok.setText("OK");\r
126         ok.addActionListener(new java.awt.event.ActionListener()\r
127             {\r
128                 public void actionPerformed(ActionEvent e)\r
129                 {\r
130                     ok_actionPerformed(e);\r
131                 }\r
132             });\r
133     cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
134         cancel.setText("Cancel");\r
135         cancel.addActionListener(new java.awt.event.ActionListener()\r
136             {\r
137                 public void actionPerformed(ActionEvent e)\r
138                 {\r
139                     cancel_actionPerformed(e);\r
140                 }\r
141             });\r
142         this.setBackground(Color.white);\r
143         jPanel1.setOpaque(false);\r
144     jPanel1.setBounds(new Rectangle(5, 6, 308, 23));\r
145     jPanel1.setLayout(borderLayout1);\r
146         jPanel2.setOpaque(false);\r
147     jPanel2.setBounds(new Rectangle(5, 37, 128, 21));\r
148     jPanel2.setLayout(borderLayout3);\r
149         jPanel3.setOpaque(false);\r
150     jPanel3.setBounds(new Rectangle(174, 38, 134, 21));\r
151     jPanel3.setLayout(borderLayout2);\r
152     defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
153     defaultButton.setText("Set as Default");\r
154         defaultButton.addActionListener(new ActionListener()\r
155             {\r
156                 public void actionPerformed(ActionEvent e)\r
157                 {\r
158                     defaultButton_actionPerformed(e);\r
159                 }\r
160             });\r
161     smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
162     smoothFont.setOpaque(false);\r
163     smoothFont.setToolTipText("");\r
164     smoothFont.setText("Anti-alias Fonts (Slower to render)");\r
165     smoothFont.setBounds(new Rectangle(41, 65, 223, 23));\r
166     smoothFont.addActionListener(new ActionListener()\r
167     {\r
168       public void actionPerformed(ActionEvent e)\r
169       {\r
170         smoothFont_actionPerformed(e);\r
171       }\r
172     });\r
173     monospaced.setEnabled(false);\r
174     monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
175     monospaced.setOpaque(false);\r
176     monospaced.setToolTipText("Monospaced fonts are faster to render");\r
177     monospaced.setText("Monospaced");\r
178     jPanel4.setOpaque(false);\r
179     jPanel4.setBounds(new Rectangle(24, 92, 259, 35));\r
180     jPanel1.add(jLabel1, BorderLayout.WEST);\r
181         jPanel1.add(fontName, BorderLayout.CENTER);\r
182     jPanel1.add(monospaced, java.awt.BorderLayout.EAST);\r
183     this.add(jPanel3, null);\r
184     this.add(jPanel2, null);\r
185     jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);\r
186     jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);\r
187     jPanel4.add(defaultButton);\r
188     jPanel4.add(ok);\r
189     jPanel4.add(cancel);\r
190     this.add(smoothFont);\r
191     this.add(jPanel4);\r
192     jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);\r
193     jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);\r
194     this.add(jPanel1, null);\r
195   }\r
196 \r
197     /**\r
198      * DOCUMENT ME!\r
199      *\r
200      * @param e DOCUMENT ME!\r
201      */\r
202     protected void ok_actionPerformed(ActionEvent e)\r
203     {\r
204     }\r
205 \r
206     /**\r
207      * DOCUMENT ME!\r
208      *\r
209      * @param e DOCUMENT ME!\r
210      */\r
211     protected void cancel_actionPerformed(ActionEvent e)\r
212     {\r
213     }\r
214 \r
215     /**\r
216      * DOCUMENT ME!\r
217      *\r
218      * @param e DOCUMENT ME!\r
219      */\r
220     protected void fontName_actionPerformed(ActionEvent e)\r
221     {\r
222     }\r
223 \r
224     /**\r
225      * DOCUMENT ME!\r
226      *\r
227      * @param e DOCUMENT ME!\r
228      */\r
229     protected void fontSize_actionPerformed(ActionEvent e)\r
230     {\r
231     }\r
232 \r
233     /**\r
234      * DOCUMENT ME!\r
235      *\r
236      * @param e DOCUMENT ME!\r
237      */\r
238     protected void fontStyle_actionPerformed(ActionEvent e)\r
239     {\r
240     }\r
241 \r
242     /**\r
243      * DOCUMENT ME!\r
244      *\r
245      * @param e DOCUMENT ME!\r
246      */\r
247     public void defaultButton_actionPerformed(ActionEvent e)\r
248     {\r
249     }\r
250 \r
251     public void smoothFont_actionPerformed(ActionEvent e)\r
252     {\r
253 \r
254     }\r
255 }\r