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