jdk/src/share/classes/sun/awt/HeadlessToolkit.java
changeset 13648 90effcfc064f
parent 11264 54f2f4c6bd30
child 23010 6dadb192ad81
--- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Wed Aug 29 15:54:28 2012 +0400
+++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java	Wed Aug 29 19:53:35 2012 +0400
@@ -30,22 +30,25 @@
 import java.awt.dnd.peer.DragSourceContextPeer;
 import java.awt.event.*;
 import java.awt.im.InputMethodHighlight;
-import java.awt.im.spi.InputMethodDescriptor;
 import java.awt.image.*;
 import java.awt.datatransfer.Clipboard;
 import java.awt.peer.*;
 import java.beans.PropertyChangeListener;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.net.URL;
 import java.util.Map;
 import java.util.Properties;
-import sun.awt.im.InputContext;
-import sun.awt.image.ImageRepresentation;
 
 public class HeadlessToolkit extends Toolkit
     implements ComponentFactory, KeyboardFocusManagerPeerProvider {
 
+    private static final KeyboardFocusManagerPeer kfmPeer = new KeyboardFocusManagerPeer() {
+        public void setCurrentFocusedWindow(Window win) {}
+        public Window getCurrentFocusedWindow() { return null; }
+        public void setCurrentFocusOwner(Component comp) {}
+        public Component getCurrentFocusOwner() { return null; }
+        public void clearGlobalFocusOwner(Window activeWindow) {}
+    };
+
     private Toolkit tk;
     private ComponentFactory componentFactory;
 
@@ -179,15 +182,9 @@
         throw new HeadlessException();
     }
 
-    public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+    public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer() {
         // See 6833019.
-        return
-            new KeyboardFocusManagerPeer() {
-                public Window getCurrentFocusedWindow() { return null; }
-                public void setCurrentFocusOwner(Component comp) {}
-                public Component getCurrentFocusOwner() { return null; }
-                public void clearGlobalFocusOwner(Window activeWindow) {}
-            };
+        return kfmPeer;
     }
 
     public TrayIconPeer createTrayIcon(TrayIcon target)