Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/java/awt/List/ScrollOutside/ScrollOut.java
38828 views
1
/*
2
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
@test
26
@bug 7036733
27
@summary Regression : NullPointerException when scrolling horizontally on AWT List
28
@author Andrei Dmitriev area=awt-list
29
@library ../../regtesthelpers
30
@build Util
31
@run main ScrollOut
32
*/
33
34
import java.awt.*;
35
import java.awt.event.*;
36
import test.java.awt.regtesthelpers.Util;
37
38
public class ScrollOut
39
{
40
public static final void main(String args[])
41
{
42
final Frame frame = new Frame();
43
final List list = new List();
44
Robot robot = null;
45
46
for (int i = 0; i < 5; i++){
47
list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
48
}
49
50
frame.add(list);
51
52
frame.pack();
53
frame.setLocationRelativeTo(null);
54
frame.setVisible(true);
55
56
57
try{
58
robot = new Robot();
59
}catch(AWTException e){
60
throw new RuntimeException(e);
61
}
62
robot.waitForIdle();
63
64
//Drag from center to the outside on left
65
Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
66
list.getLocationOnScreen().y + list.getHeight()/2);
67
Point to = new Point(list.getLocationOnScreen().x - 30,
68
from.y);
69
70
robot.waitForIdle();
71
Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
72
73
robot.waitForIdle();
74
75
//Drag from center to the outside on up
76
to = new Point(from.x,
77
list.getLocationOnScreen().y - 50);
78
79
robot.waitForIdle();
80
Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
81
82
}//End init()
83
}
84
85