Home » openjdk-7 » sun » swing » [javadoc | source]
sun.swing
public class: MenuItemLayoutHelper [javadoc | source]
java.lang.Object
   sun.swing.MenuItemLayoutHelper
Calculates preferred size and layouts menu items.
Nested Class Summary:
public static class  MenuItemLayoutHelper.LayoutResult   
public static class  MenuItemLayoutHelper.ColumnAlignment   
public static class  MenuItemLayoutHelper.RectSize   
Field Summary
public static final  StringUIClientPropertyKey MAX_ARROW_WIDTH     
public static final  StringUIClientPropertyKey MAX_CHECK_WIDTH     
public static final  StringUIClientPropertyKey MAX_ICON_WIDTH     
public static final  StringUIClientPropertyKey MAX_TEXT_WIDTH     
public static final  StringUIClientPropertyKey MAX_ACC_WIDTH     
public static final  StringUIClientPropertyKey MAX_LABEL_WIDTH     
Constructor:
 protected MenuItemLayoutHelper() 
 public MenuItemLayoutHelper(JMenuItem mi,
    Icon checkIcon,
    Icon arrowIcon,
    Rectangle viewRect,
    int gap,
    String accDelimiter,
    boolean isLeftToRight,
    Font font,
    Font accFont,
    boolean useCheckAndArrow,
    String propertyPrefix) 
Method from sun.swing.MenuItemLayoutHelper Summary:
addMaxWidth,   addWidth,   calcMaxValue,   calcMaxWidth,   calcMaxWidths,   calcWidthsAndHeights,   clearUsedClientProperties,   clearUsedParentClientProperties,   createMaxRect,   getAccFont,   getAccFontMetrics,   getAccSize,   getAccText,   getAfterCheckIconGap,   getArrowIcon,   getArrowSize,   getCheckIcon,   getCheckSize,   getFont,   getFontMetrics,   getGap,   getHorizontalAlignment,   getHorizontalTextPosition,   getHtmlView,   getIcon,   getIconSize,   getLTRColumnAlignment,   getLabelSize,   getLeadingGap,   getLeftTextExtraWidth,   getMenuItem,   getMenuItemParent,   getMenuItemParent,   getMinTextOffset,   getParentIntProperty,   getRTLColumnAlignment,   getText,   getTextSize,   getVerticalAlignment,   getVerticalTextPosition,   getViewRect,   isColumnLayout,   isColumnLayout,   isColumnLayout,   isLeftToRight,   isTopLevelMenu,   layoutIconAndTextInLabelRect,   layoutMenuItem,   max,   prepareForLayout,   reset,   setAccFont,   setAccFontMetrics,   setAccSize,   setAccText,   setAfterCheckIconGap,   setArrowIcon,   setArrowSize,   setCheckIcon,   setCheckSize,   setColumnLayout,   setFont,   setFontMetrics,   setGap,   setHorizontalAlignment,   setHorizontalTextPosition,   setHtmlView,   setIcon,   setIconSize,   setLabelSize,   setLeadingGap,   setLeftToRight,   setMenuItem,   setMenuItemParent,   setMinTextOffset,   setText,   setTextSize,   setTopLevelMenu,   setUseCheckAndArrow,   setVerticalAlignment,   setVerticalTextPosition,   setViewRect,   useCheckAndArrow,   useCheckAndArrow
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from sun.swing.MenuItemLayoutHelper Detail:
 public static  void addMaxWidth(RectSize size,
    int gap,
    Dimension result) 
 public static  void addWidth(int width,
    int gap,
    Dimension result) 
 protected int calcMaxValue(Object propertyName,
    int value) 
    Calculates and returns maximal value through specified parent component client property.
 protected  void calcMaxWidth(RectSize rs,
    Object key) 
 protected  void calcMaxWidths() 
 protected  void calcWidthsAndHeights() 
 public static  void clearUsedClientProperties(JComponent c) 
 public static  void clearUsedParentClientProperties(JMenuItem menuItem) 
 public static Rectangle createMaxRect() 
 public Font getAccFont() 
 public FontMetrics getAccFontMetrics() 
 public RectSize getAccSize() 
 public String getAccText() 
 public int getAfterCheckIconGap() 
 public Icon getArrowIcon() 
 public RectSize getArrowSize() 
 public Icon getCheckIcon() 
 public RectSize getCheckSize() 
 public Font getFont() 
 public FontMetrics getFontMetrics() 
 public int getGap() 
 public int getHorizontalAlignment() 
 public int getHorizontalTextPosition() 
 public View getHtmlView() 
 public Icon getIcon() 
 public RectSize getIconSize() 
 public ColumnAlignment getLTRColumnAlignment() 
 public RectSize getLabelSize() 
 public int getLeadingGap() 
 public int getLeftTextExtraWidth() 
 public JMenuItem getMenuItem() 
 public JComponent getMenuItemParent() 
 public static JComponent getMenuItemParent(JMenuItem menuItem) 
    Returns parent of this component if it is not a top-level menu Otherwise returns null.
 public int getMinTextOffset() 
 protected int getParentIntProperty(Object propertyName) 
    Returns parent client property as int.
 public ColumnAlignment getRTLColumnAlignment() 
 public String getText() 
 public RectSize getTextSize() 
 public int getVerticalAlignment() 
 public int getVerticalTextPosition() 
 public Rectangle getViewRect() 
 public boolean isColumnLayout() 
 public static boolean isColumnLayout(boolean isLeftToRight,
    JMenuItem mi) 
 public static boolean isColumnLayout(boolean isLeftToRight,
    int horizontalAlignment,
    int horizontalTextPosition,
    int verticalTextPosition) 
    Answers should we do column layout for a menu item or not. We do it when a user doesn't set any alignments and text positions manually, except the vertical alignment.
 public boolean isLeftToRight() 
 public boolean isTopLevelMenu() 
 protected  void layoutIconAndTextInLabelRect(LayoutResult lr) 
 public LayoutResult layoutMenuItem() 
    Layout icon, text, check icon, accelerator text and arrow icon in the viewRect and return their positions. If horizontalAlignment, verticalTextPosition and horizontalTextPosition are default (user doesn't set any manually) the layouting algorithm is: Elements are layouted in the five columns: check icon + icon + text + accelerator text + arrow icon In the other case elements are layouted in the four columns: check icon + label + accelerator text + arrow icon Label is union of icon and text. The order of columns can be reversed. It depends on the menu item orientation.
 public static int max(int values) 
    Finds and returns maximal integer value in the given array.
 protected  void prepareForLayout(LayoutResult lr) 
 protected  void reset(JMenuItem mi,
    Icon checkIcon,
    Icon arrowIcon,
    Rectangle viewRect,
    int gap,
    String accDelimiter,
    boolean isLeftToRight,
    Font font,
    Font accFont,
    boolean useCheckAndArrow,
    String propertyPrefix) 
 protected  void setAccFont(Font accFont) 
 protected  void setAccFontMetrics(FontMetrics accFm) 
 protected  void setAccSize(RectSize accSize) 
 protected  void setAccText(String accText) 
 protected  void setAfterCheckIconGap(int afterCheckIconGap) 
 protected  void setArrowIcon(Icon arrowIcon) 
 protected  void setArrowSize(RectSize arrowSize) 
 protected  void setCheckIcon(Icon checkIcon) 
 protected  void setCheckSize(RectSize checkSize) 
 protected  void setColumnLayout(boolean columnLayout) 
 protected  void setFont(Font font) 
 protected  void setFontMetrics(FontMetrics fm) 
 protected  void setGap(int gap) 
 protected  void setHorizontalAlignment(int horizontalAlignment) 
 protected  void setHorizontalTextPosition(int horizontalTextPosition) 
 protected  void setHtmlView(View htmlView) 
 protected  void setIcon(Icon icon) 
 protected  void setIconSize(RectSize iconSize) 
 protected  void setLabelSize(RectSize labelSize) 
 protected  void setLeadingGap(int leadingGap) 
 protected  void setLeftToRight(boolean leftToRight) 
 protected  void setMenuItem(JMenuItem mi) 
 protected  void setMenuItemParent(JComponent miParent) 
 protected  void setMinTextOffset(int minTextOffset) 
 protected  void setText(String text) 
 protected  void setTextSize(RectSize textSize) 
 protected  void setTopLevelMenu(boolean topLevelMenu) 
 protected  void setUseCheckAndArrow(boolean useCheckAndArrow) 
 protected  void setVerticalAlignment(int verticalAlignment) 
 protected  void setVerticalTextPosition(int verticalTextPosition) 
 protected  void setViewRect(Rectangle viewRect) 
 public boolean useCheckAndArrow() 
 public static boolean useCheckAndArrow(JMenuItem menuItem) 
    Returns false if the component is a JMenu and it is a top level menu (on the menubar).