2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
5 * This file is part of Jalview.
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 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
21 import java.awt.event.*;
30 public class GFontChooser extends JPanel
32 JLabel jLabel1 = new JLabel();
34 protected JComboBox fontSize = new JComboBox();
36 protected JComboBox fontStyle = new JComboBox();
38 JLabel jLabel2 = new JLabel();
40 JLabel jLabel3 = new JLabel();
42 protected JComboBox fontName = new JComboBox();
44 JButton ok = new JButton();
46 JButton cancel = new JButton();
48 JPanel jPanel1 = new JPanel();
50 JPanel jPanel2 = new JPanel();
52 JPanel jPanel3 = new JPanel();
54 BorderLayout borderLayout1 = new BorderLayout();
56 BorderLayout borderLayout2 = new BorderLayout();
58 BorderLayout borderLayout3 = new BorderLayout();
60 protected JButton defaultButton = new JButton();
62 protected JCheckBox smoothFont = new JCheckBox();
64 BorderLayout borderLayout4 = new BorderLayout();
66 protected JCheckBox monospaced = new JCheckBox();
68 JPanel jPanel4 = new JPanel();
71 * Creates a new GFontChooser object.
90 private void jbInit() throws Exception
92 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
93 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
94 jLabel1.setText("Font: ");
95 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
97 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
98 fontSize.setOpaque(false);
99 fontSize.setPreferredSize(new Dimension(50, 21));
100 fontSize.addActionListener(new java.awt.event.ActionListener()
102 public void actionPerformed(ActionEvent e)
104 fontSize_actionPerformed(e);
107 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
108 fontStyle.setOpaque(false);
109 fontStyle.setPreferredSize(new Dimension(90, 21));
110 fontStyle.addActionListener(new java.awt.event.ActionListener()
112 public void actionPerformed(ActionEvent e)
114 fontStyle_actionPerformed(e);
117 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
118 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
119 jLabel2.setText("Size: ");
120 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
121 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
122 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
123 jLabel3.setText("Style: ");
124 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
125 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
126 fontName.setMaximumSize(new Dimension(32767, 32767));
127 fontName.setMinimumSize(new Dimension(300, 21));
128 fontName.setOpaque(false);
129 fontName.setPreferredSize(new Dimension(180, 21));
130 fontName.addActionListener(new java.awt.event.ActionListener()
132 public void actionPerformed(ActionEvent e)
134 fontName_actionPerformed(e);
137 ok.setFont(new java.awt.Font("Verdana", 0, 11));
139 ok.addActionListener(new java.awt.event.ActionListener()
141 public void actionPerformed(ActionEvent e)
143 ok_actionPerformed(e);
146 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
147 cancel.setText("Cancel");
148 cancel.addActionListener(new java.awt.event.ActionListener()
150 public void actionPerformed(ActionEvent e)
152 cancel_actionPerformed(e);
155 this.setBackground(Color.white);
156 jPanel1.setOpaque(false);
157 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
158 jPanel1.setLayout(borderLayout1);
159 jPanel2.setOpaque(false);
160 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
161 jPanel2.setLayout(borderLayout3);
162 jPanel3.setOpaque(false);
163 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
164 jPanel3.setLayout(borderLayout2);
165 defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
166 defaultButton.setText("Set as Default");
167 defaultButton.addActionListener(new ActionListener()
169 public void actionPerformed(ActionEvent e)
171 defaultButton_actionPerformed(e);
174 smoothFont.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
175 smoothFont.setOpaque(false);
176 smoothFont.setText("Anti-alias Fonts (Slower to render)");
177 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
178 smoothFont.addActionListener(new ActionListener()
180 public void actionPerformed(ActionEvent e)
182 smoothFont_actionPerformed(e);
185 monospaced.setEnabled(false);
186 monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
187 monospaced.setOpaque(false);
188 monospaced.setToolTipText("Monospaced fonts are faster to render");
189 monospaced.setText("Monospaced");
190 jPanel4.setOpaque(false);
191 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
192 jPanel1.add(jLabel1, BorderLayout.WEST);
193 jPanel1.add(fontName, BorderLayout.CENTER);
194 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
195 this.add(jPanel3, null);
196 this.add(jPanel2, null);
197 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
198 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
199 jPanel4.add(defaultButton);
202 this.add(smoothFont);
204 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
205 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
206 this.add(jPanel1, null);
215 protected void ok_actionPerformed(ActionEvent e)
225 protected void cancel_actionPerformed(ActionEvent e)
235 protected void fontName_actionPerformed(ActionEvent e)
245 protected void fontSize_actionPerformed(ActionEvent e)
255 protected void fontStyle_actionPerformed(ActionEvent e)
265 public void defaultButton_actionPerformed(ActionEvent e)
269 public void smoothFont_actionPerformed(ActionEvent e)