< prev index next >
test/jdk/java/awt/event/MouseEvent/MenuDragMouseEventAbsoluteCoordsTest/MenuDragMouseEventAbsoluteCoordsTest.java
Print this page
*** 20,68 ****
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! test
@bug 4992908
@summary Need way to get location of MouseEvent in screen coordinates
! @author Andrei.Dmitriev area=event
! @run applet MenuDragMouseEventAbsoluteCoordsTest.html
*/
- import java.applet.Applet;
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
- import javax.swing.MenuSelectionManager;
- import javax.swing.MenuElement;
import test.java.awt.regtesthelpers.Util;
// The test consits of several parts:
// 1. create MenuDragMouseEvent with new Ctor and checking get(X|Y)OnScreen(),
// getLocationOnScreen(), get(X|Y), getPoint().
// 2. create MenuDragMouseEvent with old Ctor and checking get(X|Y)OnScreen(),
// getLocationOnScreen(), get(X|Y), getPoint() .
! public class MenuDragMouseEventAbsoluteCoordsTest extends Applet implements MouseListener
{
Frame frame = new Frame("MenuDragMouseEvent Test Frame");
Point mousePositionOnScreen = new Point(200, 200);
Point mousePosition = new Point(100, 100);
public void init()
{
frame.addMouseListener(this);
}//End init()
public void start ()
{
//Get things going. Request focus, set size, et cetera
frame.setSize (200,200);
frame.setVisible(true);
- validate();
try {
Util.waitForIdle(new Robot());
}catch (Exception e){
throw new RuntimeException("Test failed.", e);
--- 20,73 ----
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
! @test
! @key headful
@bug 4992908
@summary Need way to get location of MouseEvent in screen coordinates
! @library ../../../regtesthelpers
! @build Util
! @run main MenuDragMouseEventAbsoluteCoordsTest
*/
import java.awt.*;
import javax.swing.event.*;
import java.awt.event.*;
import test.java.awt.regtesthelpers.Util;
// The test consits of several parts:
// 1. create MenuDragMouseEvent with new Ctor and checking get(X|Y)OnScreen(),
// getLocationOnScreen(), get(X|Y), getPoint().
// 2. create MenuDragMouseEvent with old Ctor and checking get(X|Y)OnScreen(),
// getLocationOnScreen(), get(X|Y), getPoint() .
! public class MenuDragMouseEventAbsoluteCoordsTest implements MouseListener
{
Frame frame = new Frame("MenuDragMouseEvent Test Frame");
Point mousePositionOnScreen = new Point(200, 200);
Point mousePosition = new Point(100, 100);
+
+ public static void main(String[] args) {
+ MenuDragMouseEventAbsoluteCoordsTest app = new MenuDragMouseEventAbsoluteCoordsTest();
+ app.init();
+ app.start();
+ }
+
public void init()
{
frame.addMouseListener(this);
}//End init()
public void start ()
{
//Get things going. Request focus, set size, et cetera
frame.setSize (200,200);
frame.setVisible(true);
try {
Util.waitForIdle(new Robot());
}catch (Exception e){
throw new RuntimeException("Test failed.", e);
< prev index next >