2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\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
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
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
19 package jalview.jbgui;
\r
22 import java.awt.event.*;
\r
23 import javax.swing.*;
\r
29 * @version $Revision$
\r
31 public class GFontChooser
\r
34 JLabel jLabel1 = new JLabel();
\r
35 protected JComboBox fontSize = new JComboBox();
\r
36 protected JComboBox fontStyle = new JComboBox();
\r
37 JLabel jLabel2 = new JLabel();
\r
38 JLabel jLabel3 = new JLabel();
\r
39 protected JComboBox fontName = new JComboBox();
\r
40 JButton ok = new JButton();
\r
41 JButton cancel = new JButton();
\r
42 JPanel jPanel1 = new JPanel();
\r
43 JPanel jPanel2 = new JPanel();
\r
44 JPanel jPanel3 = new JPanel();
\r
45 BorderLayout borderLayout1 = new BorderLayout();
\r
46 BorderLayout borderLayout2 = new BorderLayout();
\r
47 BorderLayout borderLayout3 = new BorderLayout();
\r
48 protected JButton defaultButton = new JButton();
\r
49 protected JCheckBox smoothFont = new JCheckBox();
\r
50 BorderLayout borderLayout4 = new BorderLayout();
\r
51 protected JCheckBox monospaced = new JCheckBox();
\r
52 JPanel jPanel4 = new JPanel();
\r
55 * Creates a new GFontChooser object.
\r
57 public GFontChooser()
\r
65 e.printStackTrace();
\r
72 * @throws Exception DOCUMENT ME!
\r
74 private void jbInit()
\r
77 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
\r
78 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
\r
79 jLabel1.setText("Font: ");
\r
80 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
81 this.setLayout(null);
\r
82 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
\r
83 fontSize.setOpaque(false);
\r
84 fontSize.setPreferredSize(new Dimension(50, 21));
\r
85 fontSize.addActionListener(new java.awt.event.ActionListener()
\r
87 public void actionPerformed(ActionEvent e)
\r
89 fontSize_actionPerformed(e);
\r
92 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
\r
93 fontStyle.setOpaque(false);
\r
94 fontStyle.setPreferredSize(new Dimension(90, 21));
\r
95 fontStyle.addActionListener(new java.awt.event.ActionListener()
\r
97 public void actionPerformed(ActionEvent e)
\r
99 fontStyle_actionPerformed(e);
\r
102 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
\r
103 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
\r
104 jLabel2.setText("Size: ");
\r
105 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
106 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
\r
107 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
\r
108 jLabel3.setText("Style: ");
\r
109 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
110 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
\r
111 fontName.setMaximumSize(new Dimension(32767, 32767));
\r
112 fontName.setMinimumSize(new Dimension(300, 21));
\r
113 fontName.setOpaque(false);
\r
114 fontName.setPreferredSize(new Dimension(180, 21));
\r
115 fontName.addActionListener(new java.awt.event.ActionListener()
\r
117 public void actionPerformed(ActionEvent e)
\r
119 fontName_actionPerformed(e);
\r
122 ok.setFont(new java.awt.Font("Verdana", 0, 11));
\r
124 ok.addActionListener(new java.awt.event.ActionListener()
\r
126 public void actionPerformed(ActionEvent e)
\r
128 ok_actionPerformed(e);
\r
131 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
\r
132 cancel.setText("Cancel");
\r
133 cancel.addActionListener(new java.awt.event.ActionListener()
\r
135 public void actionPerformed(ActionEvent e)
\r
137 cancel_actionPerformed(e);
\r
140 this.setBackground(Color.white);
\r
141 jPanel1.setOpaque(false);
\r
142 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
\r
143 jPanel1.setLayout(borderLayout1);
\r
144 jPanel2.setOpaque(false);
\r
145 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
\r
146 jPanel2.setLayout(borderLayout3);
\r
147 jPanel3.setOpaque(false);
\r
148 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
\r
149 jPanel3.setLayout(borderLayout2);
\r
150 defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
151 defaultButton.setText("Set as Default");
\r
152 defaultButton.addActionListener(new ActionListener()
\r
154 public void actionPerformed(ActionEvent e)
\r
156 defaultButton_actionPerformed(e);
\r
159 smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
160 smoothFont.setOpaque(false);
\r
161 smoothFont.setText("Anti-alias Fonts (Slower to render)");
\r
162 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
\r
163 smoothFont.addActionListener(new ActionListener()
\r
165 public void actionPerformed(ActionEvent e)
\r
167 smoothFont_actionPerformed(e);
\r
170 monospaced.setEnabled(false);
\r
171 monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
172 monospaced.setOpaque(false);
\r
173 monospaced.setToolTipText("Monospaced fonts are faster to render");
\r
174 monospaced.setText("Monospaced");
\r
175 jPanel4.setOpaque(false);
\r
176 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
\r
177 jPanel1.add(jLabel1, BorderLayout.WEST);
\r
178 jPanel1.add(fontName, BorderLayout.CENTER);
\r
179 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
\r
180 this.add(jPanel3, null);
\r
181 this.add(jPanel2, null);
\r
182 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
\r
183 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
\r
184 jPanel4.add(defaultButton);
\r
186 jPanel4.add(cancel);
\r
187 this.add(smoothFont);
\r
189 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
\r
190 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
\r
191 this.add(jPanel1, null);
\r
197 * @param e DOCUMENT ME!
\r
199 protected void ok_actionPerformed(ActionEvent e)
\r
206 * @param e DOCUMENT ME!
\r
208 protected void cancel_actionPerformed(ActionEvent e)
\r
215 * @param e DOCUMENT ME!
\r
217 protected void fontName_actionPerformed(ActionEvent e)
\r
224 * @param e DOCUMENT ME!
\r
226 protected void fontSize_actionPerformed(ActionEvent e)
\r
233 * @param e DOCUMENT ME!
\r
235 protected void fontStyle_actionPerformed(ActionEvent e)
\r
242 * @param e DOCUMENT ME!
\r
244 public void defaultButton_actionPerformed(ActionEvent e)
\r
248 public void smoothFont_actionPerformed(ActionEvent e)
\r