From 65a285cb99599695503e7cc7a2e534be9c561707 Mon Sep 17 00:00:00 2001 From: Alexander Scherbatiy Date: Sat, 12 May 2012 12:01:36 +0400 Subject: [PATCH] 7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file Reviewed-by: alexp --- jdk/src/share/demo/jfc/Notepad/Notepad.java | 24 +++++++++++++------ ...em.properties => NotepadSystem.properties} | 0 2 files changed, 17 insertions(+), 7 deletions(-) rename jdk/src/share/demo/jfc/Notepad/resources/{system.properties => NotepadSystem.properties} (100%) diff --git a/jdk/src/share/demo/jfc/Notepad/Notepad.java b/jdk/src/share/demo/jfc/Notepad/Notepad.java index d023dee7990..b6c7199e256 100644 --- a/jdk/src/share/demo/jfc/Notepad/Notepad.java +++ b/jdk/src/share/demo/jfc/Notepad/Notepad.java @@ -62,7 +62,7 @@ import javax.swing.UIManager.LookAndFeelInfo; @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 @@ class Notepad extends JPanel { 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 @@ class Notepad extends JPanel { */ 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 @@ class Notepad extends JPanel { */ 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 @@ class Notepad extends JPanel { 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 @@ class Notepad extends JPanel { } } + 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); diff --git a/jdk/src/share/demo/jfc/Notepad/resources/system.properties b/jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties similarity index 100% rename from jdk/src/share/demo/jfc/Notepad/resources/system.properties rename to jdk/src/share/demo/jfc/Notepad/resources/NotepadSystem.properties