< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XToolkit.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2020, 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.  Oracle designates this

@@ -56,11 +56,10 @@
 import java.awt.Panel;
 import java.awt.Point;
 import java.awt.PopupMenu;
 import java.awt.PrintJob;
 import java.awt.Rectangle;
-import java.awt.Robot;
 import java.awt.ScrollPane;
 import java.awt.Scrollbar;
 import java.awt.SystemColor;
 import java.awt.SystemTray;
 import java.awt.Taskbar;

@@ -1075,14 +1074,16 @@
     protected static void targetDisposedPeer(Object target, Object peer) {
         SunToolkit.targetDisposedPeer(target, peer);
     }
 
     @Override
-    public RobotPeer createRobot(Robot target, GraphicsDevice screen) {
-        return new XRobotPeer(screen.getDefaultConfiguration());
+    public RobotPeer createRobot(GraphicsDevice screen) throws AWTException {
+        if (screen instanceof X11GraphicsDevice) {
+            return new XRobotPeer((X11GraphicsDevice) screen);
+        }
+        return super.createRobot(screen);
     }
-
 
   /*
      * On X, support for dynamic layout on resizing is governed by the
      * window manager.  If the window manager supports it, it happens
      * automatically.  The setter method for this property is
< prev index next >