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
20 package jalview.appletgui;
\r
24 import jalview.jbappletgui.*;
\r
26 public class FontChooser
\r
27 extends GFontChooser
\r
32 boolean init = true;
\r
35 public FontChooser(TreePanel tp)
\r
38 oldFont = tp.getTreeFont();
\r
42 public FontChooser(AlignmentPanel ap)
\r
45 oldFont = ap.av.getFont();
\r
52 String fonts[] = Toolkit.getDefaultToolkit().getFontList();
\r
53 for (int i = 0; i < fonts.length; i++)
\r
55 fontName.addItem(fonts[i]);
\r
58 for (int i = 1; i < 31; i++)
\r
60 fontSize.addItem(i + "");
\r
63 fontStyle.addItem("plain");
\r
64 fontStyle.addItem("bold");
\r
65 fontStyle.addItem("italic");
\r
67 fontName.select(oldFont.getName());
\r
68 fontSize.select(oldFont.getSize() + "");
\r
69 fontStyle.select(oldFont.getStyle());
\r
71 Frame frame = new Frame();
\r
74 jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 100);
\r
79 protected void ok_actionPerformed()
\r
81 frame.setVisible(false);
\r
84 if (ap.getOverviewPanel() != null)
\r
86 ap.getOverviewPanel().updateOverviewImage();
\r
92 protected void cancel_actionPerformed()
\r
96 ap.av.setFont(oldFont);
\r
101 tp.setTreeFont(oldFont);
\r
102 tp.treeCanvas.repaint();
\r
105 fontName.select(oldFont.getName());
\r
106 fontSize.select(oldFont.getSize() + "");
\r
107 fontStyle.select(oldFont.getStyle());
\r
109 frame.setVisible(false);
\r
114 Font newFont = new Font(fontName.getSelectedItem().toString(),
\r
115 fontStyle.getSelectedIndex(),
\r
116 Integer.parseInt(fontSize.getSelectedItem().
\r
121 ap.av.setFont(newFont);
\r
124 else if(tp != null)
\r
126 tp.setTreeFont(newFont);
\r
130 protected void fontName_actionPerformed()
\r
139 protected void fontSize_actionPerformed()
\r
148 protected void fontStyle_actionPerformed()
\r