changeset 5538:3b8635e357e9

7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file Reviewed-by: alexp
author alexsch
date Sat, 12 May 2012 12:01:36 +0400
parents 689c0cd214e8
children cc8d1cc533bf
files src/share/demo/jfc/Notepad/Notepad.java src/share/demo/jfc/Notepad/resources/NotepadSystem.properties src/share/demo/jfc/Notepad/resources/system.properties
diffstat 3 files changed, 29 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/demo/jfc/Notepad/Notepad.java	Fri May 11 20:37:07 2012 +0400
+++ b/src/share/demo/jfc/Notepad/Notepad.java	Sat May 12 12:01:36 2012 +0400
@@ -62,7 +62,7 @@
 @SuppressWarnings("serial")
 class Notepad extends JPanel {
 
-    private static Properties properties;
+    protected static Properties properties;
     private static ResourceBundle resources;
     private final static String EXIT_AFTER_PAINT = "-exit";
     private static boolean exitAfterFirstPaint;
@@ -77,12 +77,12 @@
         try {
             properties = new Properties();
             properties.load(Notepad.class.getResourceAsStream(
-                    "resources/system.properties"));
+                    "resources/NotepadSystem.properties"));
             resources = ResourceBundle.getBundle("resources.Notepad",
                     Locale.getDefault());
         } catch (MissingResourceException | IOException  e) {
             System.err.println("resources/Notepad.properties "
-                    + "or resources/system.properties not found");
+                    + "or resources/NotepadSystem.properties not found");
             System.exit(1);
         }
     }
@@ -298,7 +298,7 @@
      */
     private Component createToolbar() {
         toolbar = new JToolBar();
-        for (String toolKey: TOOLBAR_KEYS) {
+        for (String toolKey: getToolBarKeys()) {
             if (toolKey.equals("-")) {
                 toolbar.add(Box.createHorizontalStrut(5));
             } else {
@@ -363,7 +363,7 @@
      */
     protected JMenuBar createMenubar() {
         JMenuBar mb = new JMenuBar();
-        for(String menuKey: MENUBAR_KEYS){
+        for(String menuKey: getMenuBarKeys()){
             JMenu m = createMenu(menuKey);
             if (m != null) {
                 mb.add(m);
@@ -389,8 +389,10 @@
         return menu;
     }
 
-    // get keys for menus
-    private String[] getItemKeys(String key) {
+    /**
+     *  Get keys for menus
+     */
+    protected String[] getItemKeys(String key) {
         switch (key) {
             case "file":
                 return FILE_KEYS;
@@ -403,6 +405,14 @@
         }
     }
 
+    protected String[] getMenuBarKeys() {
+        return MENUBAR_KEYS;
+    }
+
+    protected String[] getToolBarKeys() {
+        return TOOLBAR_KEYS;
+    }
+
     // Yarked from JMenu, ideally this would be public.
     protected PropertyChangeListener createActionChangeListener(JMenuItem b) {
         return new ActionChangedListener(b);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties	Sat May 12 12:01:36 2012 +0400
@@ -0,0 +1,12 @@
+#
+# Non-translatable properties for Notepad example
+
+ViewportBackingStore=false
+
+cutAction=cut-to-clipboard
+copyAction=copy-to-clipboard
+pasteAction=paste-from-clipboard
+undoAction=Undo
+redoAction=Redo
+dumpAction=dump-model
+
--- a/src/share/demo/jfc/Notepad/resources/system.properties	Fri May 11 20:37:07 2012 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#
-# Non-translatable properties for Notepad example
-
-ViewportBackingStore=false
-
-cutAction=cut-to-clipboard
-copyAction=copy-to-clipboard
-pasteAction=paste-from-clipboard
-undoAction=Undo
-redoAction=Redo
-dumpAction=dump-model
-