< prev index next >

test/jdk/javax/swing/JScrollPane/HorizontalMouseWheelOnShiftPressed/HorizontalMouseWheelOnShiftPressed.java

Print this page
rev 51542 : 8210039: move OSInfo to top level testlibrary
Reviewed-by: duke


  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 import java.awt.BorderLayout;
  25 import java.awt.Point;
  26 import java.awt.Robot;
  27 import java.awt.event.KeyEvent;
  28 import javax.swing.JFrame;
  29 import javax.swing.JPanel;
  30 import javax.swing.JScrollPane;
  31 import javax.swing.JTextArea;
  32 import javax.swing.SwingUtilities;
  33 
  34 import jdk.testlibrary.OSInfo;
  35 
  36 /**
  37  * @test
  38  * @key headful
  39  * @bug 8033000 8147994
  40  * @author Alexander Scherbatiy
  41  * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
  42  * @library ../../../../lib/testlibrary
  43  * @build jdk.testlibrary.OSInfo
  44  * @run main HorizontalMouseWheelOnShiftPressed
  45  */
  46 public class HorizontalMouseWheelOnShiftPressed {
  47 
  48     private static JScrollPane scrollPane;
  49     private static JTextArea textArea;
  50     private static Point point;
  51     private static final int delta;
  52     private static JFrame frame;
  53 
  54     static {
  55         delta = OSInfo.getOSType().equals(OSInfo.OSType.MACOSX) ? -30 : 30;
  56     }
  57 
  58     public static void main(String[] args) throws Exception {
  59 
  60         Robot robot = new Robot();
  61         robot.setAutoDelay(50);
  62 
  63         SwingUtilities.invokeAndWait(
  64                 HorizontalMouseWheelOnShiftPressed::createAndShowGUI);
  65         robot.waitForIdle();
  66         try {
  67             test(robot);
  68         } finally {
  69             frame.dispose();
  70         }
  71     }
  72 
  73     private static void test(Robot robot) throws Exception {
  74         SwingUtilities.invokeAndWait(() -> {
  75             Point locationOnScreen = scrollPane.getLocationOnScreen();




  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 import java.awt.BorderLayout;
  25 import java.awt.Point;
  26 import java.awt.Robot;
  27 import java.awt.event.KeyEvent;
  28 import javax.swing.JFrame;
  29 import javax.swing.JPanel;
  30 import javax.swing.JScrollPane;
  31 import javax.swing.JTextArea;
  32 import javax.swing.SwingUtilities;
  33 
  34 import jdk.test.lib.Platform;
  35 
  36 /**
  37  * @test
  38  * @key headful
  39  * @bug 8033000 8147994
  40  * @author Alexander Scherbatiy
  41  * @summary No Horizontal Mouse Wheel Support In BasicScrollPaneUI
  42  * @library /test/lib
  43  * @build jdk.test.lib.Platform
  44  * @run main HorizontalMouseWheelOnShiftPressed
  45  */
  46 public class HorizontalMouseWheelOnShiftPressed {
  47 
  48     private static JScrollPane scrollPane;
  49     private static JTextArea textArea;
  50     private static Point point;
  51     private static final int delta;
  52     private static JFrame frame;
  53 
  54     static {
  55         delta = Platform.isOSX() ? -30 : 30;
  56     }
  57 
  58     public static void main(String[] args) throws Exception {
  59 
  60         Robot robot = new Robot();
  61         robot.setAutoDelay(50);
  62 
  63         SwingUtilities.invokeAndWait(
  64                 HorizontalMouseWheelOnShiftPressed::createAndShowGUI);
  65         robot.waitForIdle();
  66         try {
  67             test(robot);
  68         } finally {
  69             frame.dispose();
  70         }
  71     }
  72 
  73     private static void test(Robot robot) throws Exception {
  74         SwingUtilities.invokeAndWait(() -> {
  75             Point locationOnScreen = scrollPane.getLocationOnScreen();


< prev index next >