apply gpl development license
[jalview.git] / src / jalview / jbgui / GFontChooser.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
3  * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
4  * 
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18  */
19 package jalview.jbgui;
20
21 import java.awt.*;
22 import java.awt.event.*;
23 import javax.swing.*;
24
25 /**
26  * DOCUMENT ME!
27  * 
28  * @author $author$
29  * @version $Revision$
30  */
31 public class GFontChooser extends JPanel
32 {
33   JLabel jLabel1 = new JLabel();
34
35   protected JComboBox fontSize = new JComboBox();
36
37   protected JComboBox fontStyle = new JComboBox();
38
39   JLabel jLabel2 = new JLabel();
40
41   JLabel jLabel3 = new JLabel();
42
43   protected JComboBox fontName = new JComboBox();
44
45   JButton ok = new JButton();
46
47   JButton cancel = new JButton();
48
49   JPanel jPanel1 = new JPanel();
50
51   JPanel jPanel2 = new JPanel();
52
53   JPanel jPanel3 = new JPanel();
54
55   BorderLayout borderLayout1 = new BorderLayout();
56
57   BorderLayout borderLayout2 = new BorderLayout();
58
59   BorderLayout borderLayout3 = new BorderLayout();
60
61   protected JButton defaultButton = new JButton();
62
63   protected JCheckBox smoothFont = new JCheckBox();
64
65   BorderLayout borderLayout4 = new BorderLayout();
66
67   protected JCheckBox monospaced = new JCheckBox();
68
69   JPanel jPanel4 = new JPanel();
70
71   /**
72    * Creates a new GFontChooser object.
73    */
74   public GFontChooser()
75   {
76     try
77     {
78       jbInit();
79     } catch (Exception e)
80     {
81       e.printStackTrace();
82     }
83   }
84
85   /**
86    * DOCUMENT ME!
87    * 
88    * @throws Exception
89    *                 DOCUMENT ME!
90    */
91   private void jbInit() throws Exception
92   {
93     jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
94     jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
95     jLabel1.setText("Font: ");
96     jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
97     this.setLayout(null);
98     fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
99     fontSize.setOpaque(false);
100     fontSize.setPreferredSize(new Dimension(50, 21));
101     fontSize.addActionListener(new java.awt.event.ActionListener()
102     {
103       public void actionPerformed(ActionEvent e)
104       {
105         fontSize_actionPerformed(e);
106       }
107     });
108     fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
109     fontStyle.setOpaque(false);
110     fontStyle.setPreferredSize(new Dimension(90, 21));
111     fontStyle.addActionListener(new java.awt.event.ActionListener()
112     {
113       public void actionPerformed(ActionEvent e)
114       {
115         fontStyle_actionPerformed(e);
116       }
117     });
118     jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
119     jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
120     jLabel2.setText("Size: ");
121     jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
122     jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
123     jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
124     jLabel3.setText("Style: ");
125     jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
126     fontName.setFont(new java.awt.Font("Verdana", 0, 11));
127     fontName.setMaximumSize(new Dimension(32767, 32767));
128     fontName.setMinimumSize(new Dimension(300, 21));
129     fontName.setOpaque(false);
130     fontName.setPreferredSize(new Dimension(180, 21));
131     fontName.addActionListener(new java.awt.event.ActionListener()
132     {
133       public void actionPerformed(ActionEvent e)
134       {
135         fontName_actionPerformed(e);
136       }
137     });
138     ok.setFont(new java.awt.Font("Verdana", 0, 11));
139     ok.setText("OK");
140     ok.addActionListener(new java.awt.event.ActionListener()
141     {
142       public void actionPerformed(ActionEvent e)
143       {
144         ok_actionPerformed(e);
145       }
146     });
147     cancel.setFont(new java.awt.Font("Verdana", 0, 11));
148     cancel.setText("Cancel");
149     cancel.addActionListener(new java.awt.event.ActionListener()
150     {
151       public void actionPerformed(ActionEvent e)
152       {
153         cancel_actionPerformed(e);
154       }
155     });
156     this.setBackground(Color.white);
157     jPanel1.setOpaque(false);
158     jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
159     jPanel1.setLayout(borderLayout1);
160     jPanel2.setOpaque(false);
161     jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
162     jPanel2.setLayout(borderLayout3);
163     jPanel3.setOpaque(false);
164     jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
165     jPanel3.setLayout(borderLayout2);
166     defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
167     defaultButton.setText("Set as Default");
168     defaultButton.addActionListener(new ActionListener()
169     {
170       public void actionPerformed(ActionEvent e)
171       {
172         defaultButton_actionPerformed(e);
173       }
174     });
175     smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
176     smoothFont.setOpaque(false);
177     smoothFont.setText("Anti-alias Fonts (Slower to render)");
178     smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
179     smoothFont.addActionListener(new ActionListener()
180     {
181       public void actionPerformed(ActionEvent e)
182       {
183         smoothFont_actionPerformed(e);
184       }
185     });
186     monospaced.setEnabled(false);
187     monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
188     monospaced.setOpaque(false);
189     monospaced.setToolTipText("Monospaced fonts are faster to render");
190     monospaced.setText("Monospaced");
191     jPanel4.setOpaque(false);
192     jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
193     jPanel1.add(jLabel1, BorderLayout.WEST);
194     jPanel1.add(fontName, BorderLayout.CENTER);
195     jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
196     this.add(jPanel3, null);
197     this.add(jPanel2, null);
198     jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
199     jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
200     jPanel4.add(defaultButton);
201     jPanel4.add(ok);
202     jPanel4.add(cancel);
203     this.add(smoothFont);
204     this.add(jPanel4);
205     jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
206     jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
207     this.add(jPanel1, null);
208   }
209
210   /**
211    * DOCUMENT ME!
212    * 
213    * @param e
214    *                DOCUMENT ME!
215    */
216   protected void ok_actionPerformed(ActionEvent e)
217   {
218   }
219
220   /**
221    * DOCUMENT ME!
222    * 
223    * @param e
224    *                DOCUMENT ME!
225    */
226   protected void cancel_actionPerformed(ActionEvent e)
227   {
228   }
229
230   /**
231    * DOCUMENT ME!
232    * 
233    * @param e
234    *                DOCUMENT ME!
235    */
236   protected void fontName_actionPerformed(ActionEvent e)
237   {
238   }
239
240   /**
241    * DOCUMENT ME!
242    * 
243    * @param e
244    *                DOCUMENT ME!
245    */
246   protected void fontSize_actionPerformed(ActionEvent e)
247   {
248   }
249
250   /**
251    * DOCUMENT ME!
252    * 
253    * @param e
254    *                DOCUMENT ME!
255    */
256   protected void fontStyle_actionPerformed(ActionEvent e)
257   {
258   }
259
260   /**
261    * DOCUMENT ME!
262    * 
263    * @param e
264    *                DOCUMENT ME!
265    */
266   public void defaultButton_actionPerformed(ActionEvent e)
267   {
268   }
269
270   public void smoothFont_actionPerformed(ActionEvent e)
271   {
272
273   }
274 }