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 sun.awt.SunToolkit; 37 import test.java.awt.regtesthelpers.Util; 38 39 public class ScrollOut 40 { 41 public static final void main(String args[]) 42 { 43 final Frame frame = new Frame(); 44 final List list = new List(); 45 Robot robot = null; 46 47 for (int i = 0; i < 5; i++){ 48 list.add("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); 49 } 50 51 frame.add(list); 52 53 frame.pack(); 54 frame.setLocationRelativeTo(null); 55 frame.setVisible(true); 56 57 ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); 58 59 try{ 60 robot = new Robot(); 61 }catch(AWTException e){ 62 throw new RuntimeException(e); 63 } 64 65 //Drag from center to the outside on left 66 Point from = new Point(list.getLocationOnScreen().x + list.getWidth()/2, 67 list.getLocationOnScreen().y + list.getHeight()/2); 68 Point to = new Point(list.getLocationOnScreen().x - 30, 69 from.y); 70 71 ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); 72 Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); 73 74 ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); 75 76 //Drag from center to the outside on up 77 to = new Point(from.x, 78 list.getLocationOnScreen().y - 50); 79 80 ((SunToolkit)Toolkit.getDefaultToolkit()).realSync(); 81 Util.drag(robot, from, to, InputEvent.BUTTON1_MASK); 82 83 }//End init() 84 } | 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 } |