< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuUI.java

Print this page
rev 47711 : Fixed JDK-8178430: JMenu in GridBagLayout flickers when label text shows "..."
and is updated.
JDK-8178430: Fixed following issues with the test:
1. Throw exception in case the menu bar size is not proper.
2. Run the test for about 10 seconds, and then automatically
close the window.
3. Moved the fix from BasicMenuItemUI.java to BasicMenuUI.java
as per Sergey's suggestion.
4. Fixed the test case to correct the access to UI elements in EDT. Also, now made
sure that the main thread won't exit until the test is complete.
5.Removed unnecessary space in BasicMenuItemUI.java
6. Removed unnecessary import.
7. Moved the declaration of member variables into the constructor scope.
8. Fixed the test case to update/access all the swing components inside
SwingUtilities->invokeLater.
9. Modified the fix as suggested by Sergey.

@@ -224,12 +224,17 @@
 
     protected MenuKeyListener createMenuKeyListener(JComponent c) {
         return (MenuKeyListener)getHandler();
     }
 
+    public Dimension getMinimumSize(JComponent c) {
+        return (((JMenu)menuItem).isTopLevelMenu()) ?
+            c.getPreferredSize() : null;
+    }
+
     public Dimension getMaximumSize(JComponent c) {
-        if (((JMenu)menuItem).isTopLevelMenu() == true) {
+        if (((JMenu)menuItem).isTopLevelMenu()) {
             Dimension d = c.getPreferredSize();
             return new Dimension(d.width, Short.MAX_VALUE);
         }
         return null;
     }
< prev index next >