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