2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.jbgui;
21 import jalview.gui.JvSwingUtils;
22 import jalview.util.MessageManager;
25 import java.awt.event.*;
34 public class GFontChooser extends JPanel
36 JLabel jLabel1 = new JLabel();
38 protected JComboBox fontSize = new JComboBox();
40 protected JComboBox fontStyle = new JComboBox();
42 JLabel jLabel2 = new JLabel();
44 JLabel jLabel3 = new JLabel();
46 protected JComboBox fontName = new JComboBox();
48 JButton ok = new JButton();
50 JButton cancel = new JButton();
52 JPanel jPanel1 = new JPanel();
54 JPanel jPanel2 = new JPanel();
56 JPanel jPanel3 = new JPanel();
58 BorderLayout borderLayout1 = new BorderLayout();
60 BorderLayout borderLayout2 = new BorderLayout();
62 BorderLayout borderLayout3 = new BorderLayout();
64 protected JButton defaultButton = new JButton();
66 protected JCheckBox smoothFont = new JCheckBox();
68 BorderLayout borderLayout4 = new BorderLayout();
70 protected JCheckBox monospaced = new JCheckBox();
72 JPanel jPanel4 = new JPanel();
75 * Creates a new GFontChooser object.
94 private void jbInit() throws Exception
96 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
97 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
98 jLabel1.setText(MessageManager.getString("label.font"));
99 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
100 this.setLayout(null);
101 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
102 fontSize.setOpaque(false);
103 fontSize.setPreferredSize(new Dimension(50, 21));
104 fontSize.addActionListener(new java.awt.event.ActionListener()
106 public void actionPerformed(ActionEvent e)
108 fontSize_actionPerformed(e);
111 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
112 fontStyle.setOpaque(false);
113 fontStyle.setPreferredSize(new Dimension(90, 21));
114 fontStyle.addActionListener(new java.awt.event.ActionListener()
116 public void actionPerformed(ActionEvent e)
118 fontStyle_actionPerformed(e);
121 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
122 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
123 jLabel2.setText(MessageManager.getString("label.size"));
124 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
125 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
126 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
127 jLabel3.setText(MessageManager.getString("label.style"));
128 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
129 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
130 fontName.setMaximumSize(new Dimension(32767, 32767));
131 fontName.setMinimumSize(new Dimension(300, 21));
132 fontName.setOpaque(false);
133 fontName.setPreferredSize(new Dimension(180, 21));
134 fontName.addActionListener(new java.awt.event.ActionListener()
136 public void actionPerformed(ActionEvent e)
138 fontName_actionPerformed(e);
141 ok.setFont(new java.awt.Font("Verdana", 0, 11));
142 ok.setText(MessageManager.getString("action.ok"));
143 ok.addActionListener(new java.awt.event.ActionListener()
145 public void actionPerformed(ActionEvent e)
147 ok_actionPerformed(e);
150 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
151 cancel.setText(MessageManager.getString("action.cancel"));
152 cancel.addActionListener(new java.awt.event.ActionListener()
154 public void actionPerformed(ActionEvent e)
156 cancel_actionPerformed(e);
159 this.setBackground(Color.white);
160 jPanel1.setOpaque(false);
161 jPanel1.setBounds(new Rectangle(5, 6, 308, 23));
162 jPanel1.setLayout(borderLayout1);
163 jPanel2.setOpaque(false);
164 jPanel2.setBounds(new Rectangle(5, 37, 128, 21));
165 jPanel2.setLayout(borderLayout3);
166 jPanel3.setOpaque(false);
167 jPanel3.setBounds(new Rectangle(174, 38, 134, 21));
168 jPanel3.setLayout(borderLayout2);
169 defaultButton.setFont(JvSwingUtils.getLabelFont());
170 defaultButton.setText(MessageManager.getString("label.set_as_default"));
171 defaultButton.addActionListener(new ActionListener()
173 public void actionPerformed(ActionEvent e)
175 defaultButton_actionPerformed(e);
178 smoothFont.setFont(JvSwingUtils.getLabelFont());
179 smoothFont.setOpaque(false);
180 smoothFont.setText(MessageManager.getString("label.anti_alias_fonts"));
181 smoothFont.setBounds(new Rectangle(41, 65, 223, 23));
182 smoothFont.addActionListener(new ActionListener()
184 public void actionPerformed(ActionEvent e)
186 smoothFont_actionPerformed(e);
189 monospaced.setEnabled(false);
190 monospaced.setFont(JvSwingUtils.getLabelFont());
191 monospaced.setOpaque(false);
192 monospaced.setToolTipText(MessageManager.getString("label.monospaced_fonts_faster_to_render"));
193 monospaced.setText(MessageManager.getString("label.monospaced_font"));
194 jPanel4.setOpaque(false);
195 jPanel4.setBounds(new Rectangle(24, 92, 259, 35));
196 jPanel1.add(jLabel1, BorderLayout.WEST);
197 jPanel1.add(fontName, BorderLayout.CENTER);
198 jPanel1.add(monospaced, java.awt.BorderLayout.EAST);
199 this.add(jPanel3, null);
200 this.add(jPanel2, null);
201 jPanel2.add(fontSize, java.awt.BorderLayout.CENTER);
202 jPanel2.add(jLabel2, java.awt.BorderLayout.WEST);
203 jPanel4.add(defaultButton);
206 this.add(smoothFont);
208 jPanel3.add(jLabel3, java.awt.BorderLayout.WEST);
209 jPanel3.add(fontStyle, java.awt.BorderLayout.CENTER);
210 this.add(jPanel1, null);
219 protected void ok_actionPerformed(ActionEvent e)
229 protected void cancel_actionPerformed(ActionEvent e)
239 protected void fontName_actionPerformed(ActionEvent e)
249 protected void fontSize_actionPerformed(ActionEvent e)
259 protected void fontStyle_actionPerformed(ActionEvent e)
269 public void defaultButton_actionPerformed(ActionEvent e)
273 public void smoothFont_actionPerformed(ActionEvent e)