< prev index next >

src/java.desktop/share/classes/sun/awt/im/InputMethodPopupMenu.java

Print this page

        

@@ -42,10 +42,12 @@
 import javax.swing.JDialog;
 import javax.swing.JFrame;
 import javax.swing.JPopupMenu;
 import javax.swing.JMenu;
 import javax.swing.JMenuItem;
+import javax.swing.JWindow;
+import javax.swing.SwingUtilities;
 
 /**
  * {@code InputMethodPopupMenu} provides the popup selection menu
  */
 

@@ -54,17 +56,24 @@
     // Factory method to provide the menu, depending on the client, i.e.,
     // provide Swing popup menu if client is a swing app, otherwise AWT popup
     // is created.
     static InputMethodPopupMenu getInstance(Component client, String title) {
         if ((client instanceof JFrame) ||
-            (client instanceof JDialog)) {
+            (client instanceof JDialog) ||
+            (client instanceof JWindow)) {
                 return new JInputMethodPopupMenu(title);
         } else {
             return new AWTInputMethodPopupMenu(title);
         }
     }
 
+    static InputMethodPopupMenu getAWTInstance(Component client, String title) {
+        return new AWTInputMethodPopupMenu(title);
+    }
+
+    abstract boolean isVisible();
+
     abstract void show(Component c, int x, int y);
 
     abstract void removeAll();
 
     abstract void addSeparator();

@@ -173,11 +182,16 @@
                 delegate = new JPopupMenu(title);
             }
         }
     }
 
+    boolean isVisible() {
+        return delegate.isVisible();
+    }
+
     void show(Component c, int x, int y) {
+        SwingUtilities.updateComponentTreeUI(delegate);
         delegate.show(c, x, y);
     }
 
     void removeAll() {
         delegate.removeAll();

@@ -230,10 +244,14 @@
                 delegate = new PopupMenu(title);
             }
         }
     }
 
+    boolean isVisible() {
+        return false;
+    }
+
     void show(Component c, int x, int y) {
         delegate.show(c, x, y);
     }
 
     void removeAll() {
< prev index next >