mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-24 04:54:40 +02:00
7024965: Stylepad demo: remove non-translatable resources from Stylepad.properties file
Reviewed-by: alexp
This commit is contained in:
parent
9d4ac4c188
commit
65a285cb99
2 changed files with 17 additions and 7 deletions
|
@ -62,7 +62,7 @@ import javax.swing.UIManager.LookAndFeelInfo;
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
class Notepad extends JPanel {
|
class Notepad extends JPanel {
|
||||||
|
|
||||||
private static Properties properties;
|
protected static Properties properties;
|
||||||
private static ResourceBundle resources;
|
private static ResourceBundle resources;
|
||||||
private final static String EXIT_AFTER_PAINT = "-exit";
|
private final static String EXIT_AFTER_PAINT = "-exit";
|
||||||
private static boolean exitAfterFirstPaint;
|
private static boolean exitAfterFirstPaint;
|
||||||
|
@ -77,12 +77,12 @@ class Notepad extends JPanel {
|
||||||
try {
|
try {
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
properties.load(Notepad.class.getResourceAsStream(
|
properties.load(Notepad.class.getResourceAsStream(
|
||||||
"resources/system.properties"));
|
"resources/NotepadSystem.properties"));
|
||||||
resources = ResourceBundle.getBundle("resources.Notepad",
|
resources = ResourceBundle.getBundle("resources.Notepad",
|
||||||
Locale.getDefault());
|
Locale.getDefault());
|
||||||
} catch (MissingResourceException | IOException e) {
|
} catch (MissingResourceException | IOException e) {
|
||||||
System.err.println("resources/Notepad.properties "
|
System.err.println("resources/Notepad.properties "
|
||||||
+ "or resources/system.properties not found");
|
+ "or resources/NotepadSystem.properties not found");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ class Notepad extends JPanel {
|
||||||
*/
|
*/
|
||||||
private Component createToolbar() {
|
private Component createToolbar() {
|
||||||
toolbar = new JToolBar();
|
toolbar = new JToolBar();
|
||||||
for (String toolKey: TOOLBAR_KEYS) {
|
for (String toolKey: getToolBarKeys()) {
|
||||||
if (toolKey.equals("-")) {
|
if (toolKey.equals("-")) {
|
||||||
toolbar.add(Box.createHorizontalStrut(5));
|
toolbar.add(Box.createHorizontalStrut(5));
|
||||||
} else {
|
} else {
|
||||||
|
@ -363,7 +363,7 @@ class Notepad extends JPanel {
|
||||||
*/
|
*/
|
||||||
protected JMenuBar createMenubar() {
|
protected JMenuBar createMenubar() {
|
||||||
JMenuBar mb = new JMenuBar();
|
JMenuBar mb = new JMenuBar();
|
||||||
for(String menuKey: MENUBAR_KEYS){
|
for(String menuKey: getMenuBarKeys()){
|
||||||
JMenu m = createMenu(menuKey);
|
JMenu m = createMenu(menuKey);
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
mb.add(m);
|
mb.add(m);
|
||||||
|
@ -389,8 +389,10 @@ class Notepad extends JPanel {
|
||||||
return menu;
|
return menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get keys for menus
|
/**
|
||||||
private String[] getItemKeys(String key) {
|
* Get keys for menus
|
||||||
|
*/
|
||||||
|
protected String[] getItemKeys(String key) {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case "file":
|
case "file":
|
||||||
return FILE_KEYS;
|
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.
|
// Yarked from JMenu, ideally this would be public.
|
||||||
protected PropertyChangeListener createActionChangeListener(JMenuItem b) {
|
protected PropertyChangeListener createActionChangeListener(JMenuItem b) {
|
||||||
return new ActionChangedListener(b);
|
return new ActionChangedListener(b);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue