本文整理汇总了Java中test.java.awt.regtesthelpers.Util.pointOnComp方法的典型用法代码示例。如果您正苦于以下问题:Java Util.pointOnComp方法的具体用法?Java Util.pointOnComp怎么用?Java Util.pointOnComp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.java.awt.regtesthelpers.Util
的用法示例。
在下文中一共展示了Util.pointOnComp方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
try {
Robot r = Util.createRobot();
r.setAutoDelay(200);
r.setAutoWaitForIdle(true);
r.mouseMove(0, 0);
SwingUtilities.invokeAndWait(DisabledComponentsTest::init);
Util.waitForIdle(r);
Util.pointOnComp(b, r);
if (entered.get()) {
throw new RuntimeException("TEST FAILED: disabled button received MouseEntered event");
}
Util.clickOnComp(b, r);
if (pressed.get()) {
throw new RuntimeException("TEST FAILED: disabled button received MousePressed event");
}
} finally {
if (frame != null) {
frame.dispose();
}
}
}
示例2: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(() -> {
new RemovedComponentMouseListener();
});
Robot r = Util.createRobot();
r.setAutoDelay(100);
r.waitForIdle();
Util.pointOnComp(button, r);
r.waitForIdle();
r.mousePress(InputEvent.BUTTON1_MASK);
r.waitForIdle();
r.mouseRelease(InputEvent.BUTTON1_MASK);
r.waitForIdle();
if (!mouseReleasedReceived) {
throw new RuntimeException("mouseReleased event was not received");
}
}
示例3: start
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public void start ()
{
JButton jButton = new JButton();
this.setSize(200, 200);
this.addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e)
{
System.out.println("Wheel moved on APPLET : "+e);
actualEvents++;
}
});
this.add(jButton);
this.setVisible(true);
this.validate();
Util.waitForIdle(robot);
Util.pointOnComp(jButton, robot);
Util.waitForIdle(robot);
for (int i = 0; i < MOVE_COUNT; i++){
robot.mouseWheel(1);
robot.delay(10);
}
for (int i = 0; i < MOVE_COUNT; i++){
robot.mouseWheel(-1);
robot.delay(10);
}
Util.waitForIdle(robot);
//Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
//result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}
示例4: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String []s)
{
JFrame frame = new JFrame("A test frame");
frame.setSize(200, 200);
frame.addMouseWheelListener(new MouseWheelListener() {
public void mouseWheelMoved(MouseWheelEvent e)
{
System.out.println("Wheel moved on FRAME : "+e);
actualEvents++;
}
});
frame.setVisible(true);
Util.waitForIdle(robot);
Util.pointOnComp(frame, robot);
Util.waitForIdle(robot);
for (int i = 0; i < MOVE_COUNT; i++){
robot.mouseWheel(1);
robot.delay(10);
}
for (int i = 0; i < MOVE_COUNT; i++){
robot.mouseWheel(-1);
robot.delay(10);
}
Util.waitForIdle(robot);
//Not fair to check for multiplier 4 as it's not specified actual number of WheelEvents
//result in a single wheel rotation.
if (actualEvents != EXPECTED_COUNT) {
AbstractTest.fail("Expected events count: "+ EXPECTED_COUNT+" Actual events count: "+ actualEvents);
}
}
示例5: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) {
Robot robot = Util.createRobot();
Frame frame = new Frame("Obscured Frame");
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
Button button = new Button("Button");
frame.add(button);
Dialog dialog = new Dialog(frame, "Visible Dialog", false);
dialog.setSize(200, 200);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
frame.setVisible(true);
Util.waitForIdle(robot);
Util.pointOnComp(button, robot);
Util.waitForIdle(robot);
robot.delay(2000);
try {
if (button.getMousePosition() != null) {
throw new RuntimeException("Test Failed! Mouse position is not null for obscured component.");
}
} finally {
frame.dispose();
dialog.dispose();
}
}
示例6: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) {
Robot robot = Util.createRobot();
Frame frame = new Frame("Obscured Frame");
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
Button button = new Button("Button");
frame.add(button);
Dialog dialog = new Dialog(frame, "Visible Dialog", false);
dialog.setSize(200, 200);
dialog.setLocationRelativeTo(null);
dialog.setVisible(true);
frame.setVisible(true);
Util.waitForIdle(robot);
Util.pointOnComp(button, robot);
Util.waitForIdle(robot);
try {
if (button.getMousePosition() != null) {
throw new RuntimeException("Test Failed! Mouse position is not null for obscured component.");
}
} finally {
frame.dispose();
dialog.dispose();
}
}
示例7: testCase
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void testCase(Window w, Component comp) {
frameAdapter = new EnterExitAdapter(w);
buttonAdapter = new EnterExitAdapter(comp);
w.addMouseListener(frameAdapter);
comp.addMouseListener(buttonAdapter);
w.setSize(200, 200);
w.add(comp, BorderLayout.NORTH);
w.setLocationRelativeTo(null);
w.setVisible(true);
Point centerA = new Point(comp.getLocationOnScreen().x + comp.getWidth() / 2,
comp.getLocationOnScreen().y + comp.getHeight() / 2);
Point centerB = new Point(w.getLocationOnScreen().x + w.getWidth() / 2,
w.getLocationOnScreen().y + w.getHeight() / 2);
//for moving from A outside: don't cross the A area. Move straight to the right.
Point centerC_1 = new Point(w.getLocationOnScreen().x + w.getWidth() + 20, //go right off the border
comp.getLocationOnScreen().y + comp.getHeight() / 2); //don't cross the A area!
//for moving from B outside: don't cross the B area. Move straight to the bottom.
Point centerC_2 = new Point(w.getLocationOnScreen().x + w.getWidth() / 2,
w.getLocationOnScreen().y + w.getHeight() + 20); //go below the bottom border
//A and B areas
Util.pointOnComp(comp, r);
Util.waitForIdle(r);
frameAdapter.zeroCounters();
buttonAdapter.zeroCounters();
moveBetween(r, centerA, centerB);
checkEvents(frameAdapter, 1, 1);
checkEvents(buttonAdapter, 1, 1);
//A and C areas
Util.pointOnComp(comp, r);
Util.waitForIdle(r);
frameAdapter.zeroCounters();
buttonAdapter.zeroCounters();
moveBetween(r, centerA, centerC_1);
checkEvents(frameAdapter, 0, 0);
checkEvents(buttonAdapter, 1, 1);
//B and C areas
Util.pointOnComp(w, r);
Util.waitForIdle(r);
frameAdapter.zeroCounters();
buttonAdapter.zeroCounters();
moveBetween(r, centerB, centerC_2);
checkEvents(frameAdapter, 1, 1);
checkEvents(buttonAdapter, 0, 0);
w.setVisible(false);
Util.waitForIdle(r);
}
示例8: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String []s) throws Exception
{
Frame frame = new Frame();
frame.setBounds(100,100,400,400);
frame.setLayout(new FlowLayout());
TextArea textArea = new TextArea("TextArea", 6, 15);
frame.add(textArea);
List list = new List(3);
list.add("1");
list.add("2");
list.add("3");
frame.add(list);
MouseWheelListener listener = new MouseWheelListener(){
@Override
public void mouseWheelMoved(MouseWheelEvent mwe){
System.err.println(mwe);
passed = false;
}
};
list.addMouseWheelListener(listener);
textArea.addMouseWheelListener(listener);
frame.setVisible(true);
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
Robot robot = new Robot();
// point and wheel on the list
Util.pointOnComp(list, robot);
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
robot.mouseWheel(2);
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
// disable the text area
System.err.println(" disable text area ");
textArea.setEnabled(false);
passed = true;
// point and wheel on the text area
Util.pointOnComp(textArea, robot);
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
robot.mouseWheel(2);
((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
if (!passed) {
throw new RuntimeException(" wrong wheel events ");
}
}
示例9: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String[] args) throws Throwable {
try {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
constructTestUI();
}
});
Util.waitForIdle(null);
Robot r = new Robot();
Util.pointOnComp(frontFrame, r);
Util.waitForIdle(null);
Point pos = getMousePosition(backFrame);
if (pos != null) {
throw new RuntimeException("Test failed. Mouse position should be null but was" + pos);
}
pos = getMousePosition(frontFrame);
if (pos == null) {
throw new RuntimeException("Test failed. Mouse position should not be null");
}
r.mouseMove(189, 189);
Util.waitForIdle(null);
pos = getMousePosition(backFrame);
if (pos == null) {
throw new RuntimeException("Test failed. Mouse position should not be null");
}
} finally {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
backFrame.dispose();
frontFrame.dispose();
}
});
}
}
示例10: main
import test.java.awt.regtesthelpers.Util; //导入方法依赖的package包/类
public static void main(String []s) throws Exception
{
Frame frame = new Frame();
frame.setBounds(100,100,400,400);
frame.setLayout(new FlowLayout());
TextArea textArea = new TextArea("TextArea", 6, 15);
frame.add(textArea);
List list = new List(3);
list.add("1");
list.add("2");
list.add("3");
frame.add(list);
MouseWheelListener listener = new MouseWheelListener(){
@Override
public void mouseWheelMoved(MouseWheelEvent mwe){
System.err.println(mwe);
passed = false;
}
};
Robot robot = new Robot();
list.addMouseWheelListener(listener);
textArea.addMouseWheelListener(listener);
frame.setVisible(true);
robot.waitForIdle();
// point and wheel on the list
Util.pointOnComp(list, robot);
robot.waitForIdle();
robot.mouseWheel(2);
robot.waitForIdle();
// disable the text area
System.err.println(" disable text area ");
textArea.setEnabled(false);
passed = true;
// point and wheel on the text area
Util.pointOnComp(textArea, robot);
robot.waitForIdle();
robot.mouseWheel(2);
robot.waitForIdle();
if (!passed) {
throw new RuntimeException(" wrong wheel events ");
}
}