2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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;
21 import jalview.util.MessageManager;
24 import java.awt.event.*;
33 public class GFontChooser extends JPanel
35 JLabel jLabel1 = new JLabel();
37 protected JComboBox fontSize = new JComboBox();
39 protected JComboBox fontStyle = new JComboBox();
41 JLabel jLabel2 = new JLabel();
43 JLabel jLabel3 = new JLabel();
45 protected JComboBox fontName = new JComboBox();
47 JButton ok = new JButton();
49 JButton cancel = new JButton();
51 JPanel jPanel1 = new JPanel();
53 JPanel jPanel2 = new JPanel();
55 JPanel jPanel3 = new JPanel();
57 BorderLayout borderLayout1 = new BorderLayout();
59 BorderLayout borderLayout2 = new BorderLayout();
61 BorderLayout borderLayout3 = new BorderLayout();
63 protected JButton defaultButton = new JButton();
65 protected JCheckBox smoothFont = new JCheckBox();
67 BorderLayout borderLayout4 = new BorderLayout();
69 protected JCheckBox monospaced = new JCheckBox();
71 JPanel jPanel4 = new JPanel();
74 * Creates a new GFontChooser object.
93 private void jbInit() throws Exception
95 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
96 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
97 jLabel1.setText(MessageManager.getString("label.font"));
98 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
100 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
101 fontSize.setOpaque(false);
102 fontSize.setPreferredSize(new Dimension(50, 21));
103 fontSize.addActionListener(new java.awt.event.ActionListener()
105 public void actionPerformed(ActionEvent e)
107 fontSize_actionPerformed(e);
110 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
111 fontStyle.setOpaque(false);
112 fontStyle.setPreferredSize(new Dimension(90, 21));
113 fontStyle.addActionListener(new java.awt.event.ActionListener()
115 public void actionPerformed(ActionEvent e)
117 fontStyle_actionPerformed(e);
120 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
121 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
122 jLabel2.setText(MessageManager.getString("label.size"));
123 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
124 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
125 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
126 jLabel3.setText(MessageManager.getString("label.style"));
127 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
128 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
129 fontName.setMaximumSize(new Dimension(32767, 32767));
130 fontName.setMinimumSize(new Dimension(300, 21));
131 fontName.setOpaque(false);
132 fontName.setPreferredSize(new Dimension(180, 21));
133 fontName.addActionListener(new java.awt.event.ActionListener()
135 public void actionPerformed(ActionEvent e)
137 fontName_actionPerformed(e);
140 ok.setFont(new java.awt.Font("Verdana", 0, 11));
141 ok.setText(MessageManager.getString("action.ok"));
142 ok.addActionListener(new java.awt.event.ActionListener()
144 public void actionPerformed(ActionEvent e)
146 ok_actionPerformed(e);
149 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
150 cancel.setText(MessageManager.getString("action.cancel"));
151 cancel.addActionListener(new java.awt.event.ActionListener()
153 public void actionPerformed(ActionEvent e)
155 cancel_actionPerformed(e);
158 this.setBackground(Color.white);
159 jPanel1.setOpaque(false);
160 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
161 jPanel1.setLayout(borderLayout1);
162 jPanel2.setOpaque(false);
163 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
164 jPanel2.setLayout(borderLayout3);
165 jPanel3.setOpaque(false);
166 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
167 jPanel3.setLayout(borderLayout2);
168 defaultButton.setFont(JvSwingUtils.getLabelFont());
169 defaultButton.setText(MessageManager.getString("label.set_as_default"));
170 defaultButton.addActionListener(new ActionListener()
172 public void actionPerformed(ActionEvent e)
174 defaultButton_actionPerformed(e);
177 smoothFont.setFont(JvSwingUtils.getLabelFont());
178 smoothFont.setOpaque(false);
179 smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
180 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
181 smoothFont.addActionListener(new ActionListener()
183 public void actionPerformed(ActionEvent e)
185 smoothFont_actionPerformed(e);
188 monospaced.setEnabled(false);
189 monospaced.setFont(JvSwingUtils.getLabelFont());
190 monospaced.setOpaque(false);
191 monospaced.setToolTipText(MessageManager.getString("label.monospaced_fonts_faster_to_render"));
192 monospaced.setText(MessageManager.getString("label.monospaced_font"));
193 jPanel4.setOpaque(false);
194 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
195 jPanel1.add(jLabel1, BorderLayout.WEST);
196 jPanel1.add(fontName, BorderLayout.CENTER);
197 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
198 this.add(jPanel3, null);
199 this.add(jPanel2, null);
200 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
201 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
202 jPanel4.add(defaultButton);
205 this.add(smoothFont);
207 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
208 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
209 this.add(jPanel1, null);
218 protected void ok_actionPerformed(ActionEvent e)
228 protected void cancel_actionPerformed(ActionEvent e)
238 protected void fontName_actionPerformed(ActionEvent e)
248 protected void fontSize_actionPerformed(ActionEvent e)
258 protected void fontStyle_actionPerformed(ActionEvent e)
268 public void defaultButton_actionPerformed(ActionEvent e)
272 public void smoothFont_actionPerformed(ActionEvent e)