public class FontChooser extends GFontChooser\r
{\r
AlignmentPanel ap;\r
+ TreePanel tp;\r
Font oldFont;\r
boolean init = true;\r
JInternalFrame frame;\r
*\r
* @param ap DOCUMENT ME!\r
*/\r
+ public FontChooser(TreePanel tp)\r
+ {\r
+ this.tp = tp;\r
+ oldFont = tp.getFont();\r
+ defaultButton.setVisible(false);\r
+ init();\r
+ }\r
+ /**\r
+ * Creates a new FontChooser object.\r
+ *\r
+ * @param ap DOCUMENT ME!\r
+ */\r
public FontChooser(AlignmentPanel ap)\r
{\r
+ oldFont = ap.av.getFont();\r
+ this.ap = ap;\r
+ init();\r
+ }\r
+\r
+ void init()\r
+ {\r
frame = new JInternalFrame();\r
frame.setContentPane(this);\r
- Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
- frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+ if(tp!=null)\r
+ Desktop.addInternalFrame(frame, "Change Font (Tree Panel)", 480, 100, false);\r
+ else\r
+ Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
\r
- this.ap = ap;\r
+ frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
\r
String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
.getAvailableFontFamilyNames();\r
fontStyle.addItem("bold");\r
fontStyle.addItem("italic");\r
\r
- oldFont = ap.av.getFont();\r
fontName.setSelectedItem(oldFont.getName());\r
fontSize.setSelectedItem(oldFont.getSize() + "");\r
fontStyle.setSelectedIndex(oldFont.getStyle());\r
{\r
}\r
\r
- if (ap.getOverviewPanel() != null)\r
+ if(ap!=null)\r
{\r
+ if (ap.getOverviewPanel() != null)\r
+ {\r
ap.getOverviewPanel().updateOverviewImage();\r
+ }\r
}\r
}\r
\r
*/\r
protected void cancel_actionPerformed(ActionEvent e)\r
{\r
- ap.av.setFont(oldFont);\r
- ap.repaint();\r
+ if(ap!=null)\r
+ {\r
+ ap.av.setFont(oldFont);\r
+ ap.repaint();\r
+ }\r
+ else if(tp!=null)\r
+ {\r
+ tp.setFont(oldFont);\r
+ }\r
fontName.setSelectedItem(oldFont.getName());\r
fontSize.setSelectedItem(oldFont.getSize() + "");\r
fontStyle.setSelectedIndex(oldFont.getStyle());\r
*/\r
void changeFont()\r
{\r
- Font newFont = new Font(fontName.getSelectedItem().toString(),\r
- fontStyle.getSelectedIndex(),\r
- Integer.parseInt(fontSize.getSelectedItem().toString()));\r
+ Font newFont = new Font(fontName.getSelectedItem().toString(),\r
+ fontStyle.getSelectedIndex(),\r
+ Integer.parseInt(fontSize.getSelectedItem().toString()));\r
+ if (ap != null)\r
+ {\r
ap.av.setFont(newFont);\r
ap.fontChanged();\r
+ }\r
+ else if(tp != null)\r
+ {\r
+ tp.setFont(newFont);\r
+ }\r
}\r
\r
/**\r