コード例 #1
0
 /** Creates the font choice. The choice is filled with all the fonts supported by the toolkit. */
 protected JComboBox createFontChoice() {
   CommandChoice choice = new CommandChoice();
   String fonts[] = Toolkit.getDefaultToolkit().getFontList();
   for (int i = 0; i < fonts.length; i++) {
     choice.addItem(new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], this));
   }
   return choice;
 }
コード例 #2
0
 /**
  * Creates the fonts menus. It installs all available fonts supported by the toolkit
  * implementation.
  */
 protected JMenu createFontMenu() {
   CommandMenu menu = new CommandMenu("Font");
   String fonts[] = Toolkit.getDefaultToolkit().getFontList();
   for (int i = 0; i < fonts.length; i++) {
     menu.add(
         new UndoableCommand(new ChangeAttributeCommand(fonts[i], "FontName", fonts[i], this)));
   }
   return menu;
 }