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
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.
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.
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
19 package jalview.jbgui;
22 import java.awt.event.*;
31 public class GFontChooser extends JPanel
33 JLabel jLabel1 = new JLabel();
35 protected JComboBox fontSize = new JComboBox();
37 protected JComboBox fontStyle = new JComboBox();
39 JLabel jLabel2 = new JLabel();
41 JLabel jLabel3 = new JLabel();
43 protected JComboBox fontName = new JComboBox();
45 JButton ok = new JButton();
47 JButton cancel = new JButton();
49 JPanel jPanel1 = new JPanel();
51 JPanel jPanel2 = new JPanel();
53 JPanel jPanel3 = new JPanel();
55 BorderLayout borderLayout1 = new BorderLayout();
57 BorderLayout borderLayout2 = new BorderLayout();
59 BorderLayout borderLayout3 = new BorderLayout();
61 protected JButton defaultButton = new JButton();
63 protected JCheckBox smoothFont = new JCheckBox();
65 BorderLayout borderLayout4 = new BorderLayout();
67 protected JCheckBox monospaced = new JCheckBox();
69 JPanel jPanel4 = new JPanel();
72 * Creates a new GFontChooser object.
91 private void jbInit() throws Exception
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);
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()
103 public void actionPerformed(ActionEvent e)
105 fontSize_actionPerformed(e);
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()
113 public void actionPerformed(ActionEvent e)
115 fontStyle_actionPerformed(e);
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()
133 public void actionPerformed(ActionEvent e)
135 fontName_actionPerformed(e);
138 ok.setFont(new java.awt.Font("Verdana", 0, 11));
140 ok.addActionListener(new java.awt.event.ActionListener()
142 public void actionPerformed(ActionEvent e)
144 ok_actionPerformed(e);
147 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
148 cancel.setText("Cancel");
149 cancel.addActionListener(new java.awt.event.ActionListener()
151 public void actionPerformed(ActionEvent e)
153 cancel_actionPerformed(e);
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()
170 public void actionPerformed(ActionEvent e)
172 defaultButton_actionPerformed(e);
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()
181 public void actionPerformed(ActionEvent e)
183 smoothFont_actionPerformed(e);
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);
203 this.add(smoothFont);
205 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
206 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
207 this.add(jPanel1, null);
216 protected void ok_actionPerformed(ActionEvent e)
226 protected void cancel_actionPerformed(ActionEvent e)
236 protected void fontName_actionPerformed(ActionEvent e)
246 protected void fontSize_actionPerformed(ActionEvent e)
256 protected void fontStyle_actionPerformed(ActionEvent e)
266 public void defaultButton_actionPerformed(ActionEvent e)
270 public void smoothFont_actionPerformed(ActionEvent e)