8020708: NLS mnemonics missing in SwingSet2/JInternalFrame demo
Reviewed-by: malenkov, leonidr
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/motif/MotifInternalFrameTitlePane.java Mon Oct 14 18:52:25 2013 +0400
@@ -86,19 +86,19 @@
protected void assembleSystemMenu() {
systemMenu = new JPopupMenu();
- JMenuItem mi = systemMenu.add(new JMenuItem(restoreAction));
- mi.setMnemonic('R');
- mi = systemMenu.add(new JMenuItem(moveAction));
- mi.setMnemonic('M');
- mi = systemMenu.add(new JMenuItem(sizeAction));
- mi.setMnemonic('S');
- mi = systemMenu.add(new JMenuItem(iconifyAction));
- mi.setMnemonic('n');
- mi = systemMenu.add(new JMenuItem(maximizeAction));
- mi.setMnemonic('x');
+ JMenuItem mi = systemMenu.add(restoreAction);
+ mi.setMnemonic(getButtonMnemonic("restore"));
+ mi = systemMenu.add(moveAction);
+ mi.setMnemonic(getButtonMnemonic("move"));
+ mi = systemMenu.add(sizeAction);
+ mi.setMnemonic(getButtonMnemonic("size"));
+ mi = systemMenu.add(iconifyAction);
+ mi.setMnemonic(getButtonMnemonic("minimize"));
+ mi = systemMenu.add(maximizeAction);
+ mi.setMnemonic(getButtonMnemonic("maximize"));
systemMenu.add(new JSeparator());
- mi = systemMenu.add(new JMenuItem(closeAction));
- mi.setMnemonic('C');
+ mi = systemMenu.add(closeAction);
+ mi.setMnemonic(getButtonMnemonic("close"));
systemButton = new SystemButton();
systemButton.addActionListener(new ActionListener() {
@@ -124,6 +124,14 @@
});
}
+ private static int getButtonMnemonic(String button) {
+ try {
+ return Integer.parseInt(UIManager.getString(
+ "InternalFrameTitlePane." + button + "Button.mnemonic"));
+ } catch (NumberFormatException e) {
+ return -1;
+ }
+ }
protected void createButtons() {
minimizeButton = new MinimizeButton();
--- a/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java Mon Oct 14 18:52:25 2013 +0400
@@ -326,18 +326,27 @@
protected void addSystemMenuItems(JPopupMenu menu) {
JMenuItem mi = menu.add(restoreAction);
- mi.setMnemonic('R');
+ mi.setMnemonic(getButtonMnemonic("restore"));
mi = menu.add(moveAction);
- mi.setMnemonic('M');
+ mi.setMnemonic(getButtonMnemonic("move"));
mi = menu.add(sizeAction);
- mi.setMnemonic('S');
+ mi.setMnemonic(getButtonMnemonic("size"));
mi = menu.add(iconifyAction);
- mi.setMnemonic('n');
+ mi.setMnemonic(getButtonMnemonic("minimize"));
mi = menu.add(maximizeAction);
- mi.setMnemonic('x');
- systemPopupMenu.add(new JSeparator());
+ mi.setMnemonic(getButtonMnemonic("maximize"));
+ menu.add(new JSeparator());
mi = menu.add(closeAction);
- mi.setMnemonic('C');
+ mi.setMnemonic(getButtonMnemonic("close"));
+ }
+
+ private static int getButtonMnemonic(String button) {
+ try {
+ return Integer.parseInt(UIManager.getString(
+ "InternalFrameTitlePane." + button + "Button.mnemonic"));
+ } catch (NumberFormatException e) {
+ return -1;
+ }
}
protected void showSystemMenu(){
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic.properties Mon Oct 14 18:52:25 2013 +0400
@@ -144,12 +144,12 @@
InternalFrame.closeButtonToolTip=Close
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restore
-InternalFrameTitlePane.moveButton.textAndMnemonic=Move
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Size
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimize
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximize
-InternalFrameTitlePane.closeButton.textAndMnemonic=Close
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restore
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Move
+InternalFrameTitlePane.sizeButton.textAndMnemonic=&Size
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimize
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximize
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Close
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_de.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=Schlie\u00DFen
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiederherstellen
-InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimieren
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximieren
-InternalFrameTitlePane.closeButton.textAndMnemonic=Schlie\u00DFen
+InternalFrameTitlePane.restoreButton.textAndMnemonic=Wiede&rherstellen
+InternalFrameTitlePane.moveButton.textAndMnemonic=Verschieben(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Gr\u00F6\u00DFe(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimieren
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximieren
+InternalFrameTitlePane.closeButton.textAndMnemonic=S&chlie\u00DFen
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_es.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=Cerrar
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
-InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
-InternalFrameTitlePane.closeButton.textAndMnemonic=Cerrar
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tama\u00F1o(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Cerrar
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_fr.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=Fermer
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurer
-InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir
-InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurer
+InternalFrameTitlePane.moveButton.textAndMnemonic=D\u00E9placer(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Taille(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=R\u00E9duire(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Agrandir(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fermer(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_it.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=Chiudi
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Ripristina
-InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimensioni
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a icona
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci
-InternalFrameTitlePane.closeButton.textAndMnemonic=Chiudi
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Ripristina
+InternalFrameTitlePane.moveButton.textAndMnemonic=Sposta(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Dimen&sioni
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Riduci a ico&na
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ingrandisci(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=&Chiudi
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ja.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=\u9589\u3058\u308B
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u5143(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u30B5\u30A4\u30BA(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u9589\u3058\u308B(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_ko.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=\uB2EB\uAE30
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0
-InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654
-InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\uBCF5\uC6D0(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\uC774\uB3D9(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\uD06C\uAE30(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\uCD5C\uC18C\uD654(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\uCD5C\uB300\uD654(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\uB2EB\uAE30(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_pt_BR.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=Fechar
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=Restaurar
-InternalFrameTitlePane.moveButton.textAndMnemonic=Mover
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimizar
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximizar
-InternalFrameTitlePane.closeButton.textAndMnemonic=Fechar
+InternalFrameTitlePane.restoreButton.textAndMnemonic=&Restaurar
+InternalFrameTitlePane.moveButton.textAndMnemonic=&Mover
+InternalFrameTitlePane.sizeButton.textAndMnemonic=Tamanho(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimizar
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximizar
+InternalFrameTitlePane.closeButton.textAndMnemonic=Fe&char
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_sv.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=St\u00E4ng
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll
-InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta
-InternalFrameTitlePane.sizeButton.textAndMnemonic=Storlek
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=Minimera
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=Maximera
-InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u00C5terst\u00E4ll(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=Flytta(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=&Storlek
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=Mi&nimera
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=Ma&ximera
+InternalFrameTitlePane.closeButton.textAndMnemonic=St\u00E4ng(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_CN.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=\u5173\u95ED
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u8FD8\u539F(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52A8(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u5173\u95ED(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/com/sun/swing/internal/plaf/basic/resources/basic_zh_TW.properties Mon Oct 14 18:52:25 2013 +0400
@@ -143,12 +143,12 @@
InternalFrame.closeButtonToolTip=\u95DC\u9589
############ Internal Frame Title Pane Strings ############
-InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F
-InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5
-InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F
-InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316
-InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316
-InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589
+InternalFrameTitlePane.restoreButton.textAndMnemonic=\u5FA9\u539F(&R)
+InternalFrameTitlePane.moveButton.textAndMnemonic=\u79FB\u52D5(&M)
+InternalFrameTitlePane.sizeButton.textAndMnemonic=\u5927\u5C0F(&S)
+InternalFrameTitlePane.minimizeButton.textAndMnemonic=\u6700\u5C0F\u5316(&N)
+InternalFrameTitlePane.maximizeButton.textAndMnemonic=\u6700\u5927\u5316(&X)
+InternalFrameTitlePane.closeButton.textAndMnemonic=\u95DC\u9589(&C)
############ Text strings #############
# Used for html forms
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Mon Oct 14 18:52:25 2013 +0400
@@ -270,18 +270,27 @@
protected void addSystemMenuItems(JMenu systemMenu) {
JMenuItem mi = systemMenu.add(restoreAction);
- mi.setMnemonic('R');
+ mi.setMnemonic(getButtonMnemonic("restore"));
mi = systemMenu.add(moveAction);
- mi.setMnemonic('M');
+ mi.setMnemonic(getButtonMnemonic("move"));
mi = systemMenu.add(sizeAction);
- mi.setMnemonic('S');
+ mi.setMnemonic(getButtonMnemonic("size"));
mi = systemMenu.add(iconifyAction);
- mi.setMnemonic('n');
+ mi.setMnemonic(getButtonMnemonic("minimize"));
mi = systemMenu.add(maximizeAction);
- mi.setMnemonic('x');
+ mi.setMnemonic(getButtonMnemonic("maximize"));
systemMenu.add(new JSeparator());
mi = systemMenu.add(closeAction);
- mi.setMnemonic('C');
+ mi.setMnemonic(getButtonMnemonic("close"));
+ }
+
+ private static int getButtonMnemonic(String button) {
+ try {
+ return Integer.parseInt(UIManager.getString(
+ "InternalFrameTitlePane." + button + "Button.mnemonic"));
+ } catch (NumberFormatException e) {
+ return -1;
+ }
}
protected JMenu createSystemMenu() {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Mon Oct 14 18:19:19 2013 +0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Mon Oct 14 18:52:25 2013 +0400
@@ -191,20 +191,28 @@
}
protected void addSystemMenuItems(JPopupMenu menu) {
- // PENDING: this should all be localizable!
JMenuItem mi = menu.add(restoreAction);
- mi.setMnemonic('R');
+ mi.setMnemonic(getButtonMnemonic("restore"));
mi = menu.add(moveAction);
- mi.setMnemonic('M');
+ mi.setMnemonic(getButtonMnemonic("move"));
mi = menu.add(sizeAction);
- mi.setMnemonic('S');
+ mi.setMnemonic(getButtonMnemonic("size"));
mi = menu.add(iconifyAction);
- mi.setMnemonic('n');
+ mi.setMnemonic(getButtonMnemonic("minimize"));
mi = menu.add(maximizeAction);
- mi.setMnemonic('x');
+ mi.setMnemonic(getButtonMnemonic("maximize"));
menu.add(new JSeparator());
mi = menu.add(closeAction);
- mi.setMnemonic('C');
+ mi.setMnemonic(getButtonMnemonic("close"));
+ }
+
+ private static int getButtonMnemonic(String button) {
+ try {
+ return Integer.parseInt(UIManager.getString(
+ "InternalFrameTitlePane." + button + "Button.mnemonic"));
+ } catch (NumberFormatException e) {
+ return -1;
+ }
}
protected void showSystemMenu() {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JInternalFrame/8020708/bug8020708.java Mon Oct 14 18:52:25 2013 +0400
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.util.Locale;
+import javax.swing.JDesktopPane;
+import javax.swing.JFrame;
+import javax.swing.JInternalFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8020708
+ * @author Alexander Scherbatiy
+ * @summary NLS: mnemonics missing in SwingSet2/JInternalFrame demo
+ * @library ../../regtesthelpers
+ * @build Util
+ * @run main bug8020708
+ */
+public class bug8020708 {
+
+ private static final Locale[] SUPPORTED_LOCALES = {
+ Locale.ENGLISH,
+ new Locale("de"),
+ new Locale("es"),
+ new Locale("fr"),
+ new Locale("it"),
+ new Locale("ja"),
+ new Locale("ko"),
+ new Locale("pt", "BR"),
+ new Locale("sv"),
+ new Locale("zh", "CN"),
+ new Locale("zh", "TW")
+ };
+ private static final String[] LOOK_AND_FEELS = {
+ "Nimbus",
+ "Windows",
+ "Motif"
+ };
+ private static JInternalFrame internalFrame;
+ private static JFrame frame;
+
+ public static void main(String[] args) throws Exception {
+ for (Locale locale : SUPPORTED_LOCALES) {
+ for (String laf : LOOK_AND_FEELS) {
+ Locale.setDefault(locale);
+ if (!installLookAndFeel(laf)) {
+ continue;
+ }
+ testInternalFrameMnemonic();
+ }
+ }
+ }
+
+ static void testInternalFrameMnemonic() throws Exception {
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame = new JFrame("Test");
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setSize(300, 200);
+
+ JDesktopPane desktop = new JDesktopPane();
+ internalFrame = new JInternalFrame("Test");
+ internalFrame.setSize(200, 100);
+ internalFrame.setClosable(true);
+ desktop.add(internalFrame);
+ internalFrame.setVisible(true);
+ internalFrame.setMaximizable(true);
+
+ frame.getContentPane().add(desktop);
+ frame.setVisible(true);
+ }
+ });
+
+ toolkit.realSync();
+
+ Point clickPoint = Util.getCenterPoint(internalFrame);
+ robot.mouseMove(clickPoint.x, clickPoint.y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ Util.hitKeys(robot, KeyEvent.VK_CONTROL, KeyEvent.VK_SPACE);
+ toolkit.realSync();
+
+ Util.hitKeys(robot, KeyEvent.VK_C);
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ if (internalFrame.isVisible()) {
+ throw new RuntimeException("Close mnemonic does not work");
+ }
+ frame.dispose();
+ }
+ });
+ }
+
+ static final boolean installLookAndFeel(String lafName) throws Exception {
+ UIManager.LookAndFeelInfo[] infos = UIManager.getInstalledLookAndFeels();
+ for (UIManager.LookAndFeelInfo info : infos) {
+ if (info.getClassName().contains(lafName)) {
+ UIManager.setLookAndFeel(info.getClassName());
+ return true;
+ }
+ }
+ return false;
+ }
+}