--- a/jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java Fri Jul 25 14:26:27 2008 -0400
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/DefaultMenuLayout.java Fri Aug 08 20:49:26 2008 +0400
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-2008 Sun Microsystems, Inc. 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
@@ -47,19 +47,22 @@
super(target, axis);
}
- public void invalidateLayout(Container target) {
+ public Dimension preferredLayoutSize(Container target) {
if (target instanceof JPopupMenu) {
- SynthPopupMenuUI popupUI = (SynthPopupMenuUI)((JPopupMenu)target).
- getUI();
- popupUI.resetAlignmentHints();
+ JPopupMenu popupMenu = (JPopupMenu) target;
+
+ popupMenu.putClientProperty(
+ SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
+ sun.swing.MenuItemLayoutHelper.clearUsedClientProperties(popupMenu);
+
+ if (popupMenu.getComponentCount() == 0) {
+ return new Dimension(0, 0);
+ }
}
+
+ // Make BoxLayout recalculate cached preferred sizes
super.invalidateLayout(target);
- }
- public Dimension preferredLayoutSize(Container target) {
- if (target instanceof JPopupMenu && target.getComponentCount() == 0) {
- return new Dimension(0, 0);
- }
return super.preferredLayoutSize(target);
}
}