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