< prev index next >
test/jdk/java/awt/Focus/FocusSubRequestTest/FocusSubRequestTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2014, 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.
--- 1,7 ----
/*
! * Copyright (c) 2004, 2018, 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.
*** 20,46 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! test
@bug 5082319
@summary Tests that focus request for already focused component doesn't block key events.
! @author anton.tarasov@sun.com
! @run applet FocusSubRequestTest.html
*/
- import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
! public class FocusSubRequestTest extends Applet {
Frame frame = new Frame("Test Frame");
Button button = new Button("button");
boolean passed = false;
Robot robot;
public void init() {
frame.add(button);
button.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
System.out.println("FocusSubRequestTest: focusGained for: " + e.getSource());
--- 20,51 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! @test
! @key headful
@bug 5082319
@summary Tests that focus request for already focused component doesn't block key events.
! @run main FocusSubRequestTest
*/
import java.awt.*;
import java.awt.event.*;
! public class FocusSubRequestTest {
Frame frame = new Frame("Test Frame");
Button button = new Button("button");
boolean passed = false;
Robot robot;
+ public static void main(final String[] args) {
+ FocusSubRequestTest app = new FocusSubRequestTest();
+ app.init();
+ app.start();
+ }
+
public void init() {
frame.add(button);
button.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
System.out.println("FocusSubRequestTest: focusGained for: " + e.getSource());
*** 62,72 ****
}
}
public void start() {
frame.pack();
! frame.setLocation(getLocation().x + getSize().width + 20, 0);
frame.setVisible(true);
waitTillShown(button);
frame.toFront();
--- 67,77 ----
}
}
public void start() {
frame.pack();
! frame.setLocationRelativeTo(null);
frame.setVisible(true);
waitTillShown(button);
frame.toFront();
< prev index next >