< prev index next >

test/jdk/java/awt/Mouse/ExtraMouseClick/ExtraMouseClick.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 20,41 **** * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! test ! @bug 5039416 6404008 7087869 @summary REGRESSION: Extra mouse click dispatched after press-drag- release sequence. @library ../../regtesthelpers @build Util ! @author andrei.dmitriev area=awt.event ! @run applet ExtraMouseClick.html */ - import java.applet.Applet; import java.awt.AWTException; - import java.awt.BorderLayout; import java.awt.Frame; import java.awt.Point; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.InputEvent; --- 20,39 ---- * or visit www.oracle.com if you need additional information or have any * questions. */ /* ! @test ! @key headful ! @bug 5039416 6404008 @summary REGRESSION: Extra mouse click dispatched after press-drag- release sequence. @library ../../regtesthelpers @build Util ! @run main ExtraMouseClick */ import java.awt.AWTException; import java.awt.Frame; import java.awt.Point; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.InputEvent;
*** 48,60 **** // Here are two values of smugde used in this test (2 and 5). They should be on // different sides from value 4 (smudge distance on both toolkits). // Note that this test may not fail easily. But it must always pass on // patched workspace. //** ! ! public class ExtraMouseClick extends Applet ! { Frame frame = new Frame("Extra Click After MouseDrag"); final int TRIALS = 10; final int SMUDGE_WIDTH = 4; final int SMUDGE_HEIGHT = 4; Robot robot; --- 46,56 ---- // Here are two values of smugde used in this test (2 and 5). They should be on // different sides from value 4 (smudge distance on both toolkits). // Note that this test may not fail easily. But it must always pass on // patched workspace. //** ! public class ExtraMouseClick { Frame frame = new Frame("Extra Click After MouseDrag"); final int TRIALS = 10; final int SMUDGE_WIDTH = 4; final int SMUDGE_HEIGHT = 4; Robot robot;
*** 62,75 **** boolean dragged = false; boolean clicked = false; boolean pressed = false; boolean released = false; public void init() { - this.setLayout (new BorderLayout ()); - frame.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println("MousePressed"); pressed = true; } --- 58,75 ---- boolean dragged = false; boolean clicked = false; boolean pressed = false; boolean released = false; + public static void main(final String[] args) { + ExtraMouseClick app = new ExtraMouseClick(); + app.init(); + app.start(); + } + public void init() { frame.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { System.out.println("MousePressed"); pressed = true; }
*** 97,106 **** --- 97,107 ---- public void start () { frame.setSize(480, 300); + frame.setLocationRelativeTo(null); frame.setVisible(true); try{ robot = new Robot(); }catch(AWTException e){ throw new RuntimeException(e);
< prev index next >