< prev index next >
test/jdk/java/awt/event/MouseEvent/MouseWheelEventAbsoluteCoordsTest/MouseWheelEventAbsoluteCoordsTest.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * 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,18 +20,19 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
- test
+ @test
+ @key headful
@bug 4992908
@summary Need way to get location of MouseEvent in screen coordinates
- @author Andrei.Dmitriev area=event
- @run applet MouseWheelEventAbsoluteCoordsTest.html
+ @library ../../../regtesthelpers
+ @build Util
+ @run main MouseWheelEventAbsoluteCoordsTest
*/
-import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import test.java.awt.regtesthelpers.Util;
// The test consits of several parts:
@@ -39,32 +40,35 @@
// getLocationOnScreen(), get(X|Y), getPoint().
// 2. create MouseWheelEvent with old Ctor and checking get(X|Y)OnScreen(),
// getLocationOnScreen(), get(X|Y), getPoint() .
-public class MouseWheelEventAbsoluteCoordsTest extends Applet implements MouseWheelListener
+public class MouseWheelEventAbsoluteCoordsTest implements MouseWheelListener
{
Frame frame = new Frame("MouseWheelEvent Test Frame");
Point mousePositionOnScreen = new Point(200, 200);
Point mousePosition = new Point(100, 100);
- public void init()
- {
- this.setLayout (new BorderLayout ());
+ public static void main(final String[] args) {
+ MouseWheelEventAbsoluteCoordsTest app = new MouseWheelEventAbsoluteCoordsTest();
+ app.init();
+ app.start();
+ }
+ public void init()
+ {
frame.addMouseWheelListener(this);
}//End init()
public void start ()
{
//Get things going. Request focus, set size, et cetera
frame.setSize (200,200);
frame.setLocation(47, 47);
frame.setVisible(true);
- validate();
try {
Util.waitForIdle(new Robot());
}catch (Exception e){
throw new RuntimeException("Test failed.", e);
}
< prev index next >