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
22 import jalview.jbappletgui.GFontChooser;
\r
23 import jalview.appletgui.*;
\r
25 import java.awt.event.*;
\r
28 public class FontChooser extends GFontChooser
\r
32 boolean init = true;
\r
35 public FontChooser(AlignmentPanel ap, Frame frame)
\r
42 String fonts[] = Toolkit.getDefaultToolkit().getFontList();
\r
43 for(int i=0; i<fonts.length; i++)
\r
44 fontName.addItem(fonts[i]);
\r
46 for(int i=1; i<31; i++)
\r
47 fontSize.addItem(i+"");
\r
49 fontStyle.addItem("plain");
\r
50 fontStyle.addItem("bold");
\r
51 fontStyle.addItem("italic");
\r
53 oldFont = ap.av.getFont();
\r
54 fontName.select(oldFont.getName());
\r
55 fontSize.select(oldFont.getSize()+"");
\r
56 fontStyle.select(oldFont.getStyle());
\r
61 protected void ok_actionPerformed()
\r
63 frame.setVisible(false);
\r
64 if(ap.getOverviewPanel()!=null)
\r
65 ap.getOverviewPanel().updateOverviewImage();
\r
68 protected void cancel_actionPerformed()
\r
70 ap.av.setFont(oldFont);
\r
72 fontName.select(oldFont.getName());
\r
73 fontSize.select(oldFont.getSize()+"");
\r
74 fontStyle.select(oldFont.getStyle());
\r
76 frame.setVisible(false);
\r
81 Font newFont = new Font(fontName.getSelectedItem().toString(),
\r
82 fontStyle.getSelectedIndex(),
\r
83 Integer.parseInt(fontSize.getSelectedItem().toString())
\r
85 ap.av.setFont(newFont);
\r
90 protected void fontName_actionPerformed()
\r
96 protected void fontSize_actionPerformed()
\r
102 protected void fontStyle_actionPerformed()
\r