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 JButton defaultButton = new JButton();
\r
53 * Creates a new GFontChooser object.
\r
55 public GFontChooser()
\r
63 e.printStackTrace();
\r
70 * @throws Exception DOCUMENT ME!
\r
72 private void jbInit() throws Exception
\r
74 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
\r
75 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
\r
76 jLabel1.setText("Font: ");
\r
77 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
78 this.setLayout(flowLayout1);
\r
79 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
\r
80 fontSize.setOpaque(false);
\r
81 fontSize.setPreferredSize(new Dimension(50, 21));
\r
82 fontSize.addActionListener(new java.awt.event.ActionListener()
\r
84 public void actionPerformed(ActionEvent e)
\r
86 fontSize_actionPerformed(e);
\r
89 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
\r
90 fontStyle.setOpaque(false);
\r
91 fontStyle.setPreferredSize(new Dimension(90, 21));
\r
92 fontStyle.addActionListener(new java.awt.event.ActionListener()
\r
94 public void actionPerformed(ActionEvent e)
\r
96 fontStyle_actionPerformed(e);
\r
99 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
\r
100 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
\r
101 jLabel2.setText("Size: ");
\r
102 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
103 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
\r
104 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
\r
105 jLabel3.setText("Style: ");
\r
106 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
107 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
\r
108 fontName.setMaximumSize(new Dimension(32767, 32767));
\r
109 fontName.setMinimumSize(new Dimension(300, 21));
\r
110 fontName.setOpaque(false);
\r
111 fontName.setPreferredSize(new Dimension(180, 21));
\r
112 fontName.addActionListener(new java.awt.event.ActionListener()
\r
114 public void actionPerformed(ActionEvent e)
\r
116 fontName_actionPerformed(e);
\r
119 ok.setFont(new java.awt.Font("Verdana", 0, 11));
\r
121 ok.addActionListener(new java.awt.event.ActionListener()
\r
123 public void actionPerformed(ActionEvent e)
\r
125 ok_actionPerformed(e);
\r
128 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
\r
129 cancel.setText("Cancel");
\r
130 cancel.addActionListener(new java.awt.event.ActionListener()
\r
132 public void actionPerformed(ActionEvent e)
\r
134 cancel_actionPerformed(e);
\r
137 this.setBackground(Color.white);
\r
138 jPanel1.setOpaque(false);
\r
139 jPanel1.setLayout(borderLayout1);
\r
140 jPanel2.setOpaque(false);
\r
141 jPanel2.setLayout(borderLayout3);
\r
142 jPanel3.setOpaque(false);
\r
143 jPanel3.setLayout(borderLayout2);
\r
144 flowLayout1.setAlignment(FlowLayout.CENTER);
\r
145 flowLayout1.setVgap(5);
\r
146 defaultButton.setText("Set as Default");
\r
147 defaultButton.addActionListener(new ActionListener()
\r
149 public void actionPerformed(ActionEvent e)
\r
151 defaultButton_actionPerformed(e);
\r
154 this.add(jPanel1, null);
\r
155 jPanel1.add(jLabel1, BorderLayout.WEST);
\r
156 jPanel1.add(fontName, BorderLayout.CENTER);
\r
157 this.add(jPanel3, null);
\r
158 this.add(jPanel2, null);
\r
159 jPanel2.add(jLabel3, BorderLayout.WEST);
\r
160 jPanel2.add(fontStyle, BorderLayout.CENTER);
\r
161 jPanel3.add(jLabel2, BorderLayout.WEST);
\r
162 jPanel3.add(fontSize, BorderLayout.CENTER);
\r
163 this.add(ok, null);
\r
164 this.add(cancel, null);
\r
165 this.add(defaultButton);
\r
171 * @param e DOCUMENT ME!
\r
173 protected void ok_actionPerformed(ActionEvent e)
\r
180 * @param e DOCUMENT ME!
\r
182 protected void cancel_actionPerformed(ActionEvent e)
\r
189 * @param e DOCUMENT ME!
\r
191 protected void fontName_actionPerformed(ActionEvent e)
\r
198 * @param e DOCUMENT ME!
\r
200 protected void fontSize_actionPerformed(ActionEvent e)
\r
207 * @param e DOCUMENT ME!
\r
209 protected void fontStyle_actionPerformed(ActionEvent e)
\r
216 * @param e DOCUMENT ME!
\r
218 public void defaultButton_actionPerformed(ActionEvent e)
\r