2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 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.*;
33 public class GFontChooser extends JPanel
35 JLabel jLabel1 = new JLabel();
36 protected JComboBox fontSize = new JComboBox();
37 protected JComboBox fontStyle = new JComboBox();
38 JLabel jLabel2 = new JLabel();
39 JLabel jLabel3 = new JLabel();
40 protected JComboBox fontName = new JComboBox();
41 JButton ok = new JButton();
42 JButton cancel = new JButton();
43 JPanel jPanel1 = new JPanel();
44 JPanel jPanel2 = new JPanel();
45 JPanel jPanel3 = new JPanel();
46 BorderLayout borderLayout1 = new BorderLayout();
47 BorderLayout borderLayout2 = new BorderLayout();
48 BorderLayout borderLayout3 = new BorderLayout();
49 FlowLayout flowLayout1 = new FlowLayout();
50 protected JButton defaultButton = new JButton();
51 protected JCheckBox monospaced = new JCheckBox();
52 BorderLayout borderLayout4 = new BorderLayout();
55 * Creates a new GFontChooser object.
72 * @throws Exception DOCUMENT ME!
74 private void jbInit() throws Exception
76 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
77 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
78 jLabel1.setText("Font: ");
79 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
80 this.setLayout(flowLayout1);
81 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
82 fontSize.setOpaque(false);
83 fontSize.setPreferredSize(new Dimension(50, 21));
84 fontSize.addActionListener(new java.awt.event.ActionListener()
86 public void actionPerformed(ActionEvent e)
88 fontSize_actionPerformed(e);
91 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
92 fontStyle.setOpaque(false);
93 fontStyle.setPreferredSize(new Dimension(90, 21));
94 fontStyle.addActionListener(new java.awt.event.ActionListener()
96 public void actionPerformed(ActionEvent e)
98 fontStyle_actionPerformed(e);
101 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
102 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
103 jLabel2.setText("Size: ");
104 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
105 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
106 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
107 jLabel3.setText("Style: ");
108 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
109 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
110 fontName.setMaximumSize(new Dimension(32767, 32767));
111 fontName.setMinimumSize(new Dimension(300, 21));
112 fontName.setOpaque(false);
113 fontName.setPreferredSize(new Dimension(180, 21));
114 fontName.addActionListener(new java.awt.event.ActionListener()
116 public void actionPerformed(ActionEvent e)
118 fontName_actionPerformed(e);
121 ok.setFont(new java.awt.Font("Verdana", 0, 11));
123 ok.addActionListener(new java.awt.event.ActionListener()
125 public void actionPerformed(ActionEvent e)
127 ok_actionPerformed(e);
130 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
131 cancel.setText("Cancel");
132 cancel.addActionListener(new java.awt.event.ActionListener()
134 public void actionPerformed(ActionEvent e)
136 cancel_actionPerformed(e);
139 this.setBackground(Color.white);
140 jPanel1.setOpaque(false);
141 jPanel1.setLayout(borderLayout1);
142 jPanel2.setOpaque(false);
143 jPanel2.setLayout(borderLayout3);
144 jPanel3.setOpaque(false);
145 jPanel3.setLayout(borderLayout2);
146 flowLayout1.setAlignment(FlowLayout.CENTER);
147 flowLayout1.setHgap(1);
148 flowLayout1.setVgap(5);
149 defaultButton.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
150 defaultButton.setText("Set as Default");
151 defaultButton.addActionListener(new ActionListener()
153 public void actionPerformed(ActionEvent e)
155 defaultButton_actionPerformed(e);
158 monospaced.setEnabled(false);
159 monospaced.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
160 monospaced.setOpaque(false);
161 monospaced.setToolTipText("Monospaced fonts are faster to render");
162 monospaced.setText("Monospaced");
163 this.add(jPanel1, null);
164 jPanel1.add(jLabel1, BorderLayout.WEST);
165 jPanel1.add(fontName, BorderLayout.CENTER);
166 this.add(monospaced);
167 this.add(jPanel3, null);
168 this.add(jPanel2, null);
169 jPanel2.add(jLabel3, BorderLayout.WEST);
170 jPanel2.add(fontStyle, BorderLayout.CENTER);
171 jPanel3.add(jLabel2, BorderLayout.WEST);
172 jPanel3.add(fontSize, BorderLayout.CENTER);
174 this.add(cancel, null);
175 this.add(defaultButton);
181 * @param e DOCUMENT ME!
183 protected void ok_actionPerformed(ActionEvent e)
190 * @param e DOCUMENT ME!
192 protected void cancel_actionPerformed(ActionEvent e)
199 * @param e DOCUMENT ME!
201 protected void fontName_actionPerformed(ActionEvent e)
208 * @param e DOCUMENT ME!
210 protected void fontSize_actionPerformed(ActionEvent e)
217 * @param e DOCUMENT ME!
219 protected void fontStyle_actionPerformed(ActionEvent e)
226 * @param e DOCUMENT ME!
228 public void defaultButton_actionPerformed(ActionEvent e)