Java Swing - O Reilly map.addActionForKeyStroke(selPrev, getHashedAction( DefaultEditorKit.selectionPreviousWordAction)); // (Web hosting solutions)
Java Swing - O Reilly map.addActionForKeyStroke(selPrev, getHashedAction( DefaultEditorKit.selectionPreviousWordAction)); // Set the Keymap for the text componenttextComp.setKeymap(map); } // Create a simple JToolBar with some buttonsprotected JToolBar createToolBar() { JToolBar bar = new JToolBar(); // Add simple actions for opening & saving bar.add(getOpenAction()).setText(”"); bar.add(getSaveAction()).setText(”"); bar.addSeparator(); // Add cut/copy/paste buttonsbar.add(getHashedAction(DefaultEditorKit.cutAction)).setText(”"); bar.add(getHashedAction(DefaultEditorKit.copyAction)).setText(”"); bar.add(getHashedAction(DefaultEditorKit.pasteAction)).setText(”"); return bar; } // Create a JMenuBar with file & edit menus protected JMenuBar createMenuBar() { JMenuBar menubar = new JMenuBar(); JMenu file = new JMenu(”File”); JMenu edit = new JMenu(”Edit”); menubar.add(file); menubar.add(edit); file.add(getOpenAction()); file.add(getSaveAction()); file.add(new ExitAction()); edit.add(getHashedAction(DefaultEditorKit.cutAction)); edit.add(getHashedAction(DefaultEditorKit.copyAction)); edit.add(getHashedAction(DefaultEditorKit.pasteAction)); edit.add(getHashedAction(DefaultEditorKit.selectAllAction)); return menubar; } // Subclass can override to use a different open actionprotected Action getOpenAction() { return openAction; } // Subclass can override to use a different save actionprotected Action getSaveAction() { return saveAction; } protected JTextComponent getTextComponent() { return textComp; } private Action openAction = new OpenAction(); private Action saveAction = new SaveAction(); private JTextComponent textComp; private Hashtable actionHash = new Hashtable(); // ********** ACTION INNER CLASSES ********** // // A very simple “exit” action public class ExitAction extends AbstractAction { public ExitAction() { super(”Exit”); } public void actionPerformed(ActionEvent ev) { System.exit(0); } } // An action that opens an existing file - 801
If you are in need for cheap and reliable webhost to host your website, we recommend http web server services.