changeset 4986:eb7b250d92e6

7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file Reviewed-by: alexp
author alexsch
date Tue, 15 May 2012 11:45:42 +0400
parents e4c3092a3a0e
children fa84dc221972
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	Tue May 15 11:38:09 2012 +0400
+++ b/src/share/demo/jfc/Notepad/Notepad.java	Tue May 15 11:45:42 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	Tue May 15 11:45:42 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	Tue May 15 11:38:09 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
-