1 package ij.plugin.frame;
3 import java.awt.event.*;
12 private static String[] sizes = {
"8",
"9",
"10",
"12",
"14",
"18",
"24",
"28",
"36",
"48",
"60",
"72"};
13 private static int[] isizes = {8,9,10,12,14,18,24,28,36,48,60,72};
18 private static Frame instance;
27 getContentPane().setLayout(
new FlowLayout(FlowLayout.CENTER, 10, 5));
30 String[] fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();
31 for (
int i=0; i<fonts.length; i++)
33 font.select(TextRoi.getFont());
34 font.addItemListener(
this);
35 getContentPane().add(font);
38 for (
int i=0; i<sizes.length; i++)
40 size.select(getSizeIndex());
41 size.addItemListener(
this);
42 getContentPane().add(size);
48 style.add(
"Bold+Italic");
49 int i = TextRoi.getStyle();
53 else if (i==Font.ITALIC)
55 else if (i==(Font.BOLD+Font.ITALIC))
58 style.addItemListener(
this);
59 getContentPane().add(style);
66 int size = TextRoi.getSize();
68 for (
int i=0; i<isizes.length; i++) {
75 public void itemStateChanged(ItemEvent e) {
76 String fontName = font.getSelectedItem();
77 int fontSize = Integer.parseInt(size.getSelectedItem());
78 String styleName = style.getSelectedItem();
79 int fontStyle = Font.PLAIN;
80 if (styleName.equals(
"Bold"))
81 fontStyle = Font.BOLD;
82 else if (styleName.equals(
"Italic"))
83 fontStyle = Font.ITALIC;
84 else if (styleName.equals(
"Bold+Italic"))
85 fontStyle = Font.BOLD+Font.ITALIC;
86 TextRoi.setFont(fontName, fontSize, fontStyle);
87 IJ.
showStatus(fontSize+
" point "+fontName +
" " + styleName);
90 public void windowClosing(WindowEvent e) {
91 super.windowClosing(e);