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
27 public class GFontChooser extends JPanel {
\r
28 JLabel jLabel1 = new JLabel();
\r
29 protected JComboBox fontSize = new JComboBox();
\r
30 protected JComboBox fontStyle = new JComboBox();
\r
31 JLabel jLabel2 = new JLabel();
\r
32 JLabel jLabel3 = new JLabel();
\r
33 protected JComboBox fontName = new JComboBox();
\r
34 JButton ok = new JButton();
\r
35 JButton cancel = new JButton();
\r
36 JPanel jPanel1 = new JPanel();
\r
37 JPanel jPanel2 = new JPanel();
\r
38 JPanel jPanel3 = new JPanel();
\r
39 BorderLayout borderLayout1 = new BorderLayout();
\r
40 BorderLayout borderLayout2 = new BorderLayout();
\r
41 BorderLayout borderLayout3 = new BorderLayout();
\r
42 FlowLayout flowLayout1 = new FlowLayout();
\r
43 JButton defaultButton = new JButton();
\r
45 public GFontChooser() {
\r
48 } catch (Exception e) {
\r
49 e.printStackTrace();
\r
53 private void jbInit() throws Exception {
\r
54 jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));
\r
55 jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);
\r
56 jLabel1.setText("Font: ");
\r
57 jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
58 this.setLayout(flowLayout1);
\r
59 fontSize.setFont(new java.awt.Font("Verdana", 0, 11));
\r
60 fontSize.setOpaque(false);
\r
61 fontSize.setPreferredSize(new Dimension(50, 21));
\r
62 fontSize.addActionListener(new java.awt.event.ActionListener() {
\r
63 public void actionPerformed(ActionEvent e) {
\r
64 fontSize_actionPerformed(e);
\r
67 fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));
\r
68 fontStyle.setOpaque(false);
\r
69 fontStyle.setPreferredSize(new Dimension(90, 21));
\r
70 fontStyle.addActionListener(new java.awt.event.ActionListener() {
\r
71 public void actionPerformed(ActionEvent e) {
\r
72 fontStyle_actionPerformed(e);
\r
75 jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));
\r
76 jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);
\r
77 jLabel2.setText("Size: ");
\r
78 jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
79 jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));
\r
80 jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);
\r
81 jLabel3.setText("Style: ");
\r
82 jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
\r
83 fontName.setFont(new java.awt.Font("Verdana", 0, 11));
\r
84 fontName.setMaximumSize(new Dimension(32767, 32767));
\r
85 fontName.setMinimumSize(new Dimension(300, 21));
\r
86 fontName.setOpaque(false);
\r
87 fontName.setPreferredSize(new Dimension(180, 21));
\r
88 fontName.addActionListener(new java.awt.event.ActionListener() {
\r
89 public void actionPerformed(ActionEvent e) {
\r
90 fontName_actionPerformed(e);
\r
93 ok.setFont(new java.awt.Font("Verdana", 0, 11));
\r
95 ok.addActionListener(new java.awt.event.ActionListener() {
\r
96 public void actionPerformed(ActionEvent e) {
\r
97 ok_actionPerformed(e);
\r
100 cancel.setFont(new java.awt.Font("Verdana", 0, 11));
\r
101 cancel.setText("Cancel");
\r
102 cancel.addActionListener(new java.awt.event.ActionListener() {
\r
103 public void actionPerformed(ActionEvent e) {
\r
104 cancel_actionPerformed(e);
\r
107 this.setBackground(Color.white);
\r
108 jPanel1.setOpaque(false);
\r
109 jPanel1.setLayout(borderLayout1);
\r
110 jPanel2.setOpaque(false);
\r
111 jPanel2.setLayout(borderLayout3);
\r
112 jPanel3.setOpaque(false);
\r
113 jPanel3.setLayout(borderLayout2);
\r
114 flowLayout1.setAlignment(FlowLayout.CENTER);
\r
115 flowLayout1.setVgap(5);
\r
116 defaultButton.setText("Set as Default");
\r
117 defaultButton.addActionListener(new ActionListener() {
\r
118 public void actionPerformed(ActionEvent e) {
\r
119 defaultButton_actionPerformed(e);
\r
122 this.add(jPanel1, null);
\r
123 jPanel1.add(jLabel1, BorderLayout.WEST);
\r
124 jPanel1.add(fontName, BorderLayout.CENTER);
\r
125 this.add(jPanel3, null);
\r
126 this.add(jPanel2, null);
\r
127 jPanel2.add(jLabel3, BorderLayout.WEST);
\r
128 jPanel2.add(fontStyle, BorderLayout.CENTER);
\r
129 jPanel3.add(jLabel2, BorderLayout.WEST);
\r
130 jPanel3.add(fontSize, BorderLayout.CENTER);
\r
131 this.add(ok, null);
\r
132 this.add(cancel, null);
\r
133 this.add(defaultButton);
\r
136 protected void ok_actionPerformed(ActionEvent e) {
\r
139 protected void cancel_actionPerformed(ActionEvent e) {
\r
142 protected void fontName_actionPerformed(ActionEvent e) {
\r
145 protected void fontSize_actionPerformed(ActionEvent e) {
\r
148 protected void fontStyle_actionPerformed(ActionEvent e) {
\r
151 public void defaultButton_actionPerformed(ActionEvent e) {
\r