1 7 8 package javax.swing.plaf.basic; 9 10 import javax.swing.*; 11 import javax.swing.plaf.UIResource ; 12 13 import java.awt.Container ; 14 import java.awt.Dimension ; 15 16 25 26 public class DefaultMenuLayout extends BoxLayout implements UIResource { 27 public DefaultMenuLayout(Container target, int axis) { 28 super(target, axis); 29 } 30 31 public Dimension preferredLayoutSize(Container target) { 32 if (target instanceof JPopupMenu) { 33 ((JPopupMenu)target).putClientProperty( 34 BasicMenuItemUI.MAX_TEXT_WIDTH, null); 35 ((JPopupMenu)target).putClientProperty( 36 BasicMenuItemUI.MAX_ACC_WIDTH, null); 37 } 38 return super.preferredLayoutSize(target); 39 } 40 } 41 | Popular Tags |