< prev index next >

src/demo/share/jfc/Stylepad/Stylepad.java

Print this page




 238         //a = new ColorAction(se, Color.green);
 239         mi.addActionListener(a);
 240         menu.add(mi);
 241         mi = new JMenuItem(resources.getString("Blue"));
 242         mi.setHorizontalTextPosition(JButton.RIGHT);
 243         mi.setIcon(new ColoredSquare(Color.blue));
 244         a = new StyledEditorKit.ForegroundAction("set-foreground-blue",
 245                 Color.blue);
 246         //a = new ColorAction(se, Color.blue);
 247         mi.addActionListener(a);
 248         menu.add(mi);
 249 
 250         return menu;
 251     }
 252 
 253     void initDocument(DefaultStyledDocument doc, StyleContext sc) {
 254         Wonderland w = new Wonderland(doc, sc);
 255         w.loadDocument();
 256     }
 257 
 258     JComboBox createFamilyChoices() {
 259         JComboBox b = new JComboBox();
 260         String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().
 261                 getAvailableFontFamilyNames();
 262         for (String fontName : fontNames) {
 263             b.addItem(fontName);
 264         }
 265         return b;
 266     }
 267 
 268 
 269     /**
 270      * Trys to read a file which is assumed to be a
 271      * serialization of a document.
 272      */
 273     class OpenAction extends AbstractAction {
 274 
 275         OpenAction() {
 276             super(openAction);
 277         }
 278 
 279         @Override




 238         //a = new ColorAction(se, Color.green);
 239         mi.addActionListener(a);
 240         menu.add(mi);
 241         mi = new JMenuItem(resources.getString("Blue"));
 242         mi.setHorizontalTextPosition(JButton.RIGHT);
 243         mi.setIcon(new ColoredSquare(Color.blue));
 244         a = new StyledEditorKit.ForegroundAction("set-foreground-blue",
 245                 Color.blue);
 246         //a = new ColorAction(se, Color.blue);
 247         mi.addActionListener(a);
 248         menu.add(mi);
 249 
 250         return menu;
 251     }
 252 
 253     void initDocument(DefaultStyledDocument doc, StyleContext sc) {
 254         Wonderland w = new Wonderland(doc, sc);
 255         w.loadDocument();
 256     }
 257 
 258     JComboBox<String> createFamilyChoices() {
 259         JComboBox<String> b = new JComboBox<>();
 260         String[] fontNames = GraphicsEnvironment.getLocalGraphicsEnvironment().
 261                 getAvailableFontFamilyNames();
 262         for (String fontName : fontNames) {
 263             b.addItem(fontName);
 264         }
 265         return b;
 266     }
 267 
 268 
 269     /**
 270      * Trys to read a file which is assumed to be a
 271      * serialization of a document.
 272      */
 273     class OpenAction extends AbstractAction {
 274 
 275         OpenAction() {
 276             super(openAction);
 277         }
 278 
 279         @Override


< prev index next >