src/demo/share/jfc/Notepad/Notepad.java

Print this page




  47 import java.util.*;
  48 import java.util.logging.*;
  49 import javax.swing.*;
  50 import javax.swing.undo.*;
  51 import javax.swing.text.*;
  52 import javax.swing.event.*;
  53 import javax.swing.UIManager.LookAndFeelInfo;
  54 
  55 
  56 /**
  57  * Sample application using the simple text editor component that
  58  * supports only one font.
  59  *
  60  * @author  Timothy Prinzing
  61  */
  62 @SuppressWarnings("serial")
  63 class Notepad extends JPanel {
  64 
  65     protected static Properties properties;
  66     private static ResourceBundle resources;
  67     private final static String EXIT_AFTER_PAINT = "-exit";
  68     private static boolean exitAfterFirstPaint;
  69 
  70     private static final String[] MENUBAR_KEYS = {"file", "edit", "debug"};
  71     private static final String[] TOOLBAR_KEYS = {"new", "open", "save", "-", "cut", "copy", "paste"};
  72     private static final String[] FILE_KEYS = {"new", "open", "save", "-", "exit"};
  73     private static final String[] EDIT_KEYS = {"cut", "copy", "paste", "-", "undo", "redo"};
  74     private static final String[] DEBUG_KEYS = {"dump", "showElementTree"};
  75 
  76     static {
  77         try {
  78             properties = new Properties();
  79             properties.load(Notepad.class.getResourceAsStream(
  80                     "resources/NotepadSystem.properties"));
  81             resources = ResourceBundle.getBundle("resources.Notepad",
  82                     Locale.getDefault());
  83         } catch (MissingResourceException | IOException  e) {
  84             System.err.println("resources/Notepad.properties "
  85                     + "or resources/NotepadSystem.properties not found");
  86             System.exit(1);
  87         }




  47 import java.util.*;
  48 import java.util.logging.*;
  49 import javax.swing.*;
  50 import javax.swing.undo.*;
  51 import javax.swing.text.*;
  52 import javax.swing.event.*;
  53 import javax.swing.UIManager.LookAndFeelInfo;
  54 
  55 
  56 /**
  57  * Sample application using the simple text editor component that
  58  * supports only one font.
  59  *
  60  * @author  Timothy Prinzing
  61  */
  62 @SuppressWarnings("serial")
  63 class Notepad extends JPanel {
  64 
  65     protected static Properties properties;
  66     private static ResourceBundle resources;
  67     private static final String EXIT_AFTER_PAINT = "-exit";
  68     private static boolean exitAfterFirstPaint;
  69 
  70     private static final String[] MENUBAR_KEYS = {"file", "edit", "debug"};
  71     private static final String[] TOOLBAR_KEYS = {"new", "open", "save", "-", "cut", "copy", "paste"};
  72     private static final String[] FILE_KEYS = {"new", "open", "save", "-", "exit"};
  73     private static final String[] EDIT_KEYS = {"cut", "copy", "paste", "-", "undo", "redo"};
  74     private static final String[] DEBUG_KEYS = {"dump", "showElementTree"};
  75 
  76     static {
  77         try {
  78             properties = new Properties();
  79             properties.load(Notepad.class.getResourceAsStream(
  80                     "resources/NotepadSystem.properties"));
  81             resources = ResourceBundle.getBundle("resources.Notepad",
  82                     Locale.getDefault());
  83         } catch (MissingResourceException | IOException  e) {
  84             System.err.println("resources/Notepad.properties "
  85                     + "or resources/NotepadSystem.properties not found");
  86             System.exit(1);
  87         }