2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.gui.JvSwingUtils;
24 import jalview.util.MessageManager;
27 import java.awt.event.*;
36 public class GFontChooser extends JPanel
38 JLabel jLabel1 = new JLabel();
40 protected JComboBox fontSize = new JComboBox();
42 protected JComboBox fontStyle = new JComboBox();
44 JLabel jLabel2 = new JLabel();
46 JLabel jLabel3 = new JLabel();
48 protected JComboBox fontName = new JComboBox();
50 JButton ok = new JButton();
52 JButton cancel = new JButton();
54 JPanel jPanel1 = new JPanel();
56 JPanel jPanel2 = new JPanel();
58 JPanel jPanel3 = new JPanel();
60 BorderLayout borderLayout1 = new BorderLayout();
62 BorderLayout borderLayout2 = new BorderLayout();
64 BorderLayout borderLayout3 = new BorderLayout();
66 protected JButton defaultButton = new JButton();
68 protected JCheckBox smoothFont = new JCheckBox();
70 BorderLayout borderLayout4 = new BorderLayout();
72 protected JCheckBox monospaced = new JCheckBox();
74 JPanel jPanel4 = new JPanel();
77 * Creates a new GFontChooser object.
96 private void jbInit() throws Exception
98 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
99 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
100 jLabel1.setText(MessageManager.getString("label.font"));
101 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
102 this.setLayout(null);
103 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
104 fontSize.setOpaque(false);
105 fontSize.setPreferredSize(new Dimension(50, 21));
106 fontSize.addActionListener(new java.awt.event.ActionListener()
108 public void actionPerformed(ActionEvent e)
110 fontSize_actionPerformed(e);
113 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
114 fontStyle.setOpaque(false);
115 fontStyle.setPreferredSize(new Dimension(90, 21));
116 fontStyle.addActionListener(new java.awt.event.ActionListener()
118 public void actionPerformed(ActionEvent e)
120 fontStyle_actionPerformed(e);
123 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
124 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
125 jLabel2.setText(MessageManager.getString("label.size"));
126 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
127 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
128 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
129 jLabel3.setText(MessageManager.getString("label.style"));
130 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
131 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
132 fontName.setMaximumSize(new Dimension(32767, 32767));
133 fontName.setMinimumSize(new Dimension(300, 21));
134 fontName.setOpaque(false);
135 fontName.setPreferredSize(new Dimension(180, 21));
136 fontName.addActionListener(new java.awt.event.ActionListener()
138 public void actionPerformed(ActionEvent e)
140 fontName_actionPerformed(e);
143 ok.setFont(new java.awt.Font("Verdana", 0, 11));
144 ok.setText(MessageManager.getString("action.ok"));
145 ok.addActionListener(new java.awt.event.ActionListener()
147 public void actionPerformed(ActionEvent e)
149 ok_actionPerformed(e);
152 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
153 cancel.setText(MessageManager.getString("action.cancel"));
154 cancel.addActionListener(new java.awt.event.ActionListener()
156 public void actionPerformed(ActionEvent e)
158 cancel_actionPerformed(e);
161 this.setBackground(Color.white);
162 jPanel1.setOpaque(false);
163 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
164 jPanel1.setLayout(borderLayout1);
165 jPanel2.setOpaque(false);
166 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
167 jPanel2.setLayout(borderLayout3);
168 jPanel3.setOpaque(false);
169 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
170 jPanel3.setLayout(borderLayout2);
171 defaultButton.setFont(JvSwingUtils.getLabelFont());
172 defaultButton.setText(MessageManager.getString("label.set_as_default"));
173 defaultButton.addActionListener(new ActionListener()
175 public void actionPerformed(ActionEvent e)
177 defaultButton_actionPerformed(e);
180 smoothFont.setFont(JvSwingUtils.getLabelFont());
181 smoothFont.setOpaque(false);
182 smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
183 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
184 smoothFont.addActionListener(new ActionListener()
186 public void actionPerformed(ActionEvent e)
188 smoothFont_actionPerformed(e);
191 monospaced.setEnabled(false);
192 monospaced.setFont(JvSwingUtils.getLabelFont());
193 monospaced.setOpaque(false);
194 monospaced.setToolTipText(MessageManager
195 .getString("label.monospaced_fonts_faster_to_render"));
196 monospaced.setText(MessageManager.getString("label.monospaced_font"));
197 jPanel4.setOpaque(false);
198 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
199 jPanel1.add(jLabel1, BorderLayout.WEST);
200 jPanel1.add(fontName, BorderLayout.CENTER);
201 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
202 this.add(jPanel3, null);
203 this.add(jPanel2, null);
204 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
205 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
206 jPanel4.add(defaultButton);
209 this.add(smoothFont);
211 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
212 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
213 this.add(jPanel1, null);
222 protected void ok_actionPerformed(ActionEvent e)
232 protected void cancel_actionPerformed(ActionEvent e)
242 protected void fontName_actionPerformed(ActionEvent e)
252 protected void fontSize_actionPerformed(ActionEvent e)
262 protected void fontStyle_actionPerformed(ActionEvent e)
272 public void defaultButton_actionPerformed(ActionEvent e)
276 public void smoothFont_actionPerformed(ActionEvent e)