< prev index next >

test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/MenuItemActivatedTest/MenuItemActivatedTest.java

Print this page

        

*** 20,45 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! test @bug 6396785 @summary MenuItem activated with space should swallow this space. ! @author anton.tarasov@...: area=awt.focus ! @run applet MenuItemActivatedTest.html */ import java.awt.*; import java.awt.event.*; import javax.swing.*; - import java.applet.Applet; import java.util.concurrent.atomic.AtomicBoolean; - import java.lang.reflect.InvocationTargetException; import test.java.awt.regtesthelpers.Util; ! public class MenuItemActivatedTest extends Applet { Robot robot; JFrame frame = new JFrame("Test Frame"); JDialog dialog = new JDialog((Window)null, "Test Dialog", Dialog.ModalityType.DOCUMENT_MODAL); JTextField text = new JTextField(); JMenuBar bar = new JMenuBar(); --- 20,45 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! @test ! @key headful @bug 6396785 @summary MenuItem activated with space should swallow this space. ! @library ../../../regtesthelpers ! @build Util ! @run main MenuItemActivatedTest */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.concurrent.atomic.AtomicBoolean; import test.java.awt.regtesthelpers.Util; ! public class MenuItemActivatedTest { Robot robot; JFrame frame = new JFrame("Test Frame"); JDialog dialog = new JDialog((Window)null, "Test Dialog", Dialog.ModalityType.DOCUMENT_MODAL); JTextField text = new JTextField(); JMenuBar bar = new JMenuBar();
*** 53,75 **** app.start(); } public void init() { robot = Util.createRobot(); - - // Create instructions for the user here, as well as set up - // the environment -- set the layout manager, add buttons, - // etc. - this.setLayout (new BorderLayout ()); } public void start() { menu.setMnemonic('f'); menu.add(item); bar.add(menu); frame.setJMenuBar(bar); frame.pack(); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { dialog.add(text); dialog.pack(); --- 53,71 ---- app.start(); } public void init() { robot = Util.createRobot(); } public void start() { menu.setMnemonic('f'); menu.add(item); bar.add(menu); frame.setJMenuBar(bar); frame.pack(); + frame.setLocationRelativeTo(null); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { dialog.add(text); dialog.pack();
< prev index next >