< prev index next >
test/jdk/java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.java
Print this page
*** 20,45 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! test
@bug 6396785
@summary Action key pressed on a button should be swallowed.
! @author anton.tarasov@...: area=awt.focus
! @run applet ButtonActionKeyTest.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 ButtonActionKeyTest extends Applet {
Robot robot;
JFrame frame = new JFrame("Frame");
JButton button = new JButton("button");
JTextField text = new JTextField("text");
AtomicBoolean gotEvent = new AtomicBoolean(false);
--- 20,45 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! @test
! @key headful
@bug 6396785
@summary Action key pressed on a button should be swallowed.
! @library ../../../regtesthelpers
! @build Util
! @run main ButtonActionKeyTest
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.concurrent.atomic.AtomicBoolean;
import test.java.awt.regtesthelpers.Util;
! public class ButtonActionKeyTest {
Robot robot;
JFrame frame = new JFrame("Frame");
JButton button = new JButton("button");
JTextField text = new JTextField("text");
AtomicBoolean gotEvent = new AtomicBoolean(false);
*** 50,64 ****
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() {
frame.setLayout(new FlowLayout());
frame.add(button);
--- 50,59 ----
*** 82,92 ****
gotEvent.notifyAll();
}
}
}
});
!
frame.setVisible(true);
Util.waitForIdle(robot);
Util.clickOnComp(button, robot);
Util.waitForIdle(robot);
--- 77,87 ----
gotEvent.notifyAll();
}
}
}
});
! frame.setLocationRelativeTo(null);
frame.setVisible(true);
Util.waitForIdle(robot);
Util.clickOnComp(button, robot);
Util.waitForIdle(robot);
< prev index next >