2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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;
20 import jalview.gui.JvSwingUtils;
23 import java.awt.event.*;
32 public class GFontChooser extends JPanel
34 JLabel jLabel1 = new JLabel();
36 protected JComboBox fontSize = new JComboBox();
38 protected JComboBox fontStyle = new JComboBox();
40 JLabel jLabel2 = new JLabel();
42 JLabel jLabel3 = new JLabel();
44 protected JComboBox fontName = new JComboBox();
46 JButton ok = new JButton();
48 JButton cancel = new JButton();
50 JPanel jPanel1 = new JPanel();
52 JPanel jPanel2 = new JPanel();
54 JPanel jPanel3 = new JPanel();
56 BorderLayout borderLayout1 = new BorderLayout();
58 BorderLayout borderLayout2 = new BorderLayout();
60 BorderLayout borderLayout3 = new BorderLayout();
62 protected JButton defaultButton = new JButton();
64 protected JCheckBox smoothFont = new JCheckBox();
66 BorderLayout borderLayout4 = new BorderLayout();
68 protected JCheckBox monospaced = new JCheckBox();
70 JPanel jPanel4 = new JPanel();
73 * Creates a new GFontChooser object.
92 private void jbInit() throws Exception
94 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
95 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
96 jLabel1.setText("Font: ");
97 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
99 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
100 fontSize.setOpaque(false);
101 fontSize.setPreferredSize(new Dimension(50, 21));
102 fontSize.addActionListener(new java.awt.event.ActionListener()
104 public void actionPerformed(ActionEvent e)
106 fontSize_actionPerformed(e);
109 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
110 fontStyle.setOpaque(false);
111 fontStyle.setPreferredSize(new Dimension(90, 21));
112 fontStyle.addActionListener(new java.awt.event.ActionListener()
114 public void actionPerformed(ActionEvent e)
116 fontStyle_actionPerformed(e);
119 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
120 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
121 jLabel2.setText("Size: ");
122 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
123 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
124 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
125 jLabel3.setText("Style: ");
126 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
127 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
128 fontName.setMaximumSize(new Dimension(32767, 32767));
129 fontName.setMinimumSize(new Dimension(300, 21));
130 fontName.setOpaque(false);
131 fontName.setPreferredSize(new Dimension(180, 21));
132 fontName.addActionListener(new java.awt.event.ActionListener()
134 public void actionPerformed(ActionEvent e)
136 fontName_actionPerformed(e);
139 ok.setFont(new java.awt.Font("Verdana", 0, 11));
141 ok.addActionListener(new java.awt.event.ActionListener()
143 public void actionPerformed(ActionEvent e)
145 ok_actionPerformed(e);
148 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
149 cancel.setText("Cancel");
150 cancel.addActionListener(new java.awt.event.ActionListener()
152 public void actionPerformed(ActionEvent e)
154 cancel_actionPerformed(e);
157 this.setBackground(Color.white);
158 jPanel1.setOpaque(false);
159 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
160 jPanel1.setLayout(borderLayout1);
161 jPanel2.setOpaque(false);
162 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
163 jPanel2.setLayout(borderLayout3);
164 jPanel3.setOpaque(false);
165 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
166 jPanel3.setLayout(borderLayout2);
167 defaultButton.setFont(JvSwingUtils.getLabelFont());
168 defaultButton.setText("Set as Default");
169 defaultButton.addActionListener(new ActionListener()
171 public void actionPerformed(ActionEvent e)
173 defaultButton_actionPerformed(e);
176 smoothFont.setFont(JvSwingUtils.getLabelFont());
177 smoothFont.setOpaque(false);
178 smoothFont.setText("Anti-alias Fonts (Slower to render)");
179 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
180 smoothFont.addActionListener(new ActionListener()
182 public void actionPerformed(ActionEvent e)
184 smoothFont_actionPerformed(e);
187 monospaced.setEnabled(false);
188 monospaced.setFont(JvSwingUtils.getLabelFont());
189 monospaced.setOpaque(false);
190 monospaced.setToolTipText("Monospaced fonts are faster to render");
191 monospaced.setText("Monospaced");
192 jPanel4.setOpaque(false);
193 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
194 jPanel1.add(jLabel1, BorderLayout.WEST);
195 jPanel1.add(fontName, BorderLayout.CENTER);
196 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
197 this.add(jPanel3, null);
198 this.add(jPanel2, null);
199 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
200 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
201 jPanel4.add(defaultButton);
204 this.add(smoothFont);
206 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
207 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
208 this.add(jPanel1, null);
217 protected void ok_actionPerformed(ActionEvent e)
227 protected void cancel_actionPerformed(ActionEvent e)
237 protected void fontName_actionPerformed(ActionEvent e)
247 protected void fontSize_actionPerformed(ActionEvent e)
257 protected void fontStyle_actionPerformed(ActionEvent e)
267 public void defaultButton_actionPerformed(ActionEvent e)
271 public void smoothFont_actionPerformed(ActionEvent e)