4075N/A/*
4248N/A * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4075N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4075N/A *
4075N/A * This code is free software; you can redistribute it and/or modify it
4075N/A * under the terms of the GNU General Public License version 2 only, as
4075N/A * published by the Free Software Foundation.
4075N/A *
4075N/A * This code is distributed in the hope that it will be useful, but WITHOUT
4075N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4075N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
4075N/A * version 2 for more details (a copy is included in the LICENSE file that
4075N/A * accompanied this code).
4075N/A *
4075N/A * You should have received a copy of the GNU General Public License version
4075N/A * 2 along with this work; if not, write to the Free Software Foundation,
4075N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4075N/A *
4075N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4075N/A * or visit www.oracle.com if you need additional information or have any
4075N/A * questions.
4075N/A */
4075N/A
4075N/A/*
4075N/A @test
4075N/A @bug 7036733
4075N/A @summary Regression : NullPointerException when scrolling horizontally on AWT List
4075N/A @author Andrei Dmitriev area=awt-list
4075N/A @library ../../regtesthelpers
4075N/A @build Util
4075N/A @run main ScrollOut
4075N/A*/
4075N/A
4075N/Aimport java.awt.*;
4075N/Aimport java.awt.event.*;
4075N/Aimport sun.awt.SunToolkit;
4075N/Aimport test.java.awt.regtesthelpers.Util;
4075N/A
4075N/Apublic class ScrollOut
4075N/A{
4075N/A public static final void main(String args[])
4075N/A {
4075N/A final Frame frame = new Frame();
4075N/A final List list = new List();
4075N/A Robot robot = null;
4075N/A
4075N/A for (int i = 0; i < 5; i++){
4075N/A list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz");
4075N/A }
4075N/A
4075N/A frame.add(list);
4075N/A
4075N/A frame.pack();
4075N/A frame.setLocationRelativeTo(null);
4075N/A frame.setVisible(true);
4075N/A
4075N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
4075N/A
4075N/A try{
4075N/A robot = new Robot();
4075N/A }catch(AWTException e){
4075N/A throw new RuntimeException(e);
4075N/A }
4075N/A
4075N/A //Drag from center to the outside on left
4075N/A Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2,
4075N/A list.getLocationOnScreen().y + list.getHeight()/2);
4075N/A Point to = new Point(list.getLocationOnScreen().x - 30,
4075N/A from.y);
4075N/A
4075N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
4075N/A Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
4075N/A
4075N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
4075N/A
4075N/A //Drag from center to the outside on up
4075N/A to = new Point(from.x,
4075N/A list.getLocationOnScreen().y - 50);
4075N/A
4075N/A ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
4075N/A Util.drag(robot, from, to, InputEvent.BUTTON1_MASK);
4075N/A
4075N/A }//End init()
4075N/A}