< prev index next >
test/javax/swing/plaf/windows/6921687/bug6921687.java
Print this page
*** 19,69 ****
* 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.
*/
! /* @test
! @bug 6921687 8079428
! @summary Mnemonic disappears after repeated attempts to open menu items using
! mnemonics
! @author Semyon Sadetsky
! @library /lib/testlibrary
! @build jdk.testlibrary.OSInfo
! @run main bug6921687
*/
!
!
! import jdk.testlibrary.OSInfo;
! import javax.swing.*;
! import java.awt.*;
import java.awt.event.KeyEvent;
!
public class bug6921687 {
private static Class lafClass;
private static JFrame frame;
public static void main(String[] args) throws Exception {
! if (OSInfo.getOSType() != OSInfo.OSType.WINDOWS) {
System.out.println("Only Windows platform test. Test is skipped.");
System.out.println("ok");
return;
}
! lafClass = Class.forName(UIManager.getSystemLookAndFeelClassName());
! UIManager.setLookAndFeel((LookAndFeel) lafClass.newInstance());
try {
- SwingUtilities.invokeAndWait(new Runnable() {
- public void run() {
frame = new JFrame();
frame.setUndecorated(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setup(frame);
- }
- });
final Robot robot = new Robot();
robot.setAutoDelay(20);
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_ALT);
--- 19,71 ----
* 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.
*/
! /*
! * @test
! * @bug 6921687 8079428
! * @summary Mnemonic disappears after repeated attempts to open menu items using
! * mnemonics
! * @author Semyon Sadetsky
! * @library /lib/testlibrary
! * @build jdk.testlibrary.Platform
! * @requires (os.family == "windows")
! * @modules java.desktop/com.sun.java.swing.plaf.windows
! * @run main bug6921687
*/
! import java.awt.Robot;
import java.awt.event.KeyEvent;
! import javax.swing.JFrame;
! import javax.swing.JMenu;
! import javax.swing.JMenuBar;
! import javax.swing.JMenuItem;
! import javax.swing.UIManager;
! import jdk.testlibrary.Platform;
public class bug6921687 {
private static Class lafClass;
private static JFrame frame;
public static void main(String[] args) throws Exception {
! if (!Platform.isWindows()) {
System.out.println("Only Windows platform test. Test is skipped.");
System.out.println("ok");
return;
}
! final String lafClassName = UIManager.getSystemLookAndFeelClassName();
! lafClass = Class.forName(lafClassName);
! UIManager.setLookAndFeel(lafClassName);
try {
frame = new JFrame();
frame.setUndecorated(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setup(frame);
final Robot robot = new Robot();
+ robot.waitForIdle();
robot.setAutoDelay(20);
robot.keyPress(KeyEvent.VK_ALT);
robot.keyPress(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_F);
robot.keyRelease(KeyEvent.VK_ALT);
< prev index next >