{\r
AlignmentPanel ap;\r
Font oldFont;\r
+ boolean init = true;\r
+ JInternalFrame frame;\r
\r
- public FontChooser(AlignmentPanel ap)\r
+ public FontChooser(AlignmentPanel ap, JInternalFrame f)\r
{\r
this.ap = ap;\r
-\r
+ frame = f;\r
String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();\r
for(int i=0; i<fonts.length; i++)\r
fontName.addItem(fonts[i]);\r
fontSize.setSelectedItem(oldFont.getSize()+"");\r
fontStyle.setSelectedIndex(oldFont.getStyle());\r
\r
+ init = false;\r
}\r
\r
protected void ok_actionPerformed(ActionEvent e)\r
{\r
- Font newFont = new Font(fontName.getSelectedItem().toString(),\r
- fontStyle.getSelectedIndex(),\r
- Integer.parseInt(fontSize.getSelectedItem().toString()+"")\r
- );\r
- ap.av.setFont(newFont);\r
- ap.RefreshPanels();\r
- ap.RefreshPanels();\r
+ try{\r
+ frame.setClosed(true);\r
+ }catch(Exception ex){}\r
+\r
+ jalview.bin.Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());\r
+ jalview.bin.Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex()+"");\r
+ jalview.bin.Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());\r
}\r
\r
protected void cancel_actionPerformed(ActionEvent e)\r
fontStyle.setSelectedIndex(oldFont.getStyle());\r
}\r
\r
+ void changeFont()\r
+ {\r
+ Font newFont = new Font(fontName.getSelectedItem().toString(),\r
+ fontStyle.getSelectedIndex(),\r
+ Integer.parseInt(fontSize.getSelectedItem().toString())\r
+ );\r
+ ap.av.setFont(newFont);\r
+ ap.RefreshPanels();\r
+ }\r
+\r
+ protected void fontName_actionPerformed(ActionEvent e)\r
+ {\r
+ if(init) return;\r
+ changeFont();\r
+ }\r
+\r
+ protected void fontSize_actionPerformed(ActionEvent e)\r
+ {\r
+ if(init) return;\r
+ changeFont();\r
+ }\r
+\r
+ protected void fontStyle_actionPerformed(ActionEvent e)\r
+ {\r
+ if(init) return;\r
+ changeFont();\r
+ }\r
+\r
\r
}\r