jdk/src/share/classes/java/awt/Robot.java
changeset 2810 fa49c6a06baf
parent 1962 6c293d33645b
child 3232 aacdc74b37d2
--- a/jdk/src/share/classes/java/awt/Robot.java	Thu May 21 15:04:23 2009 +0400
+++ b/jdk/src/share/classes/java/awt/Robot.java	Fri May 22 16:09:45 2009 +0400
@@ -96,9 +96,13 @@
         init(GraphicsEnvironment.getLocalGraphicsEnvironment()
             .getDefaultScreenDevice());
         int tmpMask = 0;
+
         if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
-            for (int i = 0; i < peer.getNumberOfButtons(); i++){
-                tmpMask |= InputEvent.getMaskForButton(i+1);
+            if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
+                final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
+                for (int i = 0; i < buttonsNumber; i++){
+                    tmpMask |= InputEvent.getMaskForButton(i+1);
+                }
             }
         }
         tmpMask |= InputEvent.BUTTON1_MASK|