APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.swing

public Class MenuItemLayoutHelper

extends Object
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.synth.SynthMenuItemLayoutHelper
Static Imports
sun.swing.SwingUtilities2.BASICMENUITEMUI_MAX_TEXT_OFFSET

Calculates preferred size and layouts menu items.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class

Field Summary

Modifier and TypeField and Description
private FontMetrics
private Font
private MenuItemLayoutHelper.RectSize
private String
private int
private Icon
private MenuItemLayoutHelper.RectSize
private Icon
private MenuItemLayoutHelper.RectSize
private FontMetrics
private Font
private int
private int
private int
private View
private Icon
private MenuItemLayoutHelper.RectSize
private boolean
private boolean
private boolean
private MenuItemLayoutHelper.RectSize
private int
private int
public static final StringUIClientPropertyKey
public static final StringUIClientPropertyKey
public static final StringUIClientPropertyKey
public static final StringUIClientPropertyKey
public static final StringUIClientPropertyKey
public static final StringUIClientPropertyKey
private JMenuItem
private int
private JComponent
private String
private MenuItemLayoutHelper.RectSize
private boolean
private int
private int
private Rectangle

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
public static void
public static void
addWidth(int width, int gap, Dimension result)

private void
alignAccCheckAndArrowVertically(MenuItemLayoutHelper.LayoutResult lr)

Aligns the accelertor text and the check and arrow icons vertically with the center of the label rect.

private void
alignRect(Rectangle rect, int alignment, int origWidth)

private void
private void
private void
calcLabelYPosition(MenuItemLayoutHelper.LayoutResult lr)

Sets labelRect Y coordinate taking into account the vertical alignment

private void
calcMaxTextOffset(Rectangle
the rectangle, the maximal text offset will be calculated for.
viewRect
)

Calculates maximal text offset.

protected int

Returns:

maximal value among the parent property and the value.
calcMaxValue
(Object
name of the property, which stores the maximal value.
propertyName
,
int
a value which pretends to be maximal
value
)

Calculates and returns maximal value through specified parent component client property.

protected void
protected void
private void
calcTextAndIconYPositions(MenuItemLayoutHelper.LayoutResult lr)

Sets Y coordinates of text and icon taking into account the vertical alignment

protected void
private void
calcXPositionsLTR(int startXPos, int leadingGap, int gap, Rectangle... rects)

private void
calcXPositionsRTL(int startXPos, int leadingGap, int gap, Rectangle... rects)

public static void
public static void
private MenuItemLayoutHelper.LayoutResult
public static Rectangle
private void
private void
private void
private void
private void
fixVerticalAlignment(MenuItemLayoutHelper.LayoutResult lr, Rectangle r)

Fixes vertical alignment of all menu item elements if rect.y or (rect.y + rect.height) is out of viewRect bounds

public Font
public FontMetrics
public MenuItemLayoutHelper.RectSize
private String
getAccText(String acceleratorDelimiter)

public String
private int
getAfterCheckIconGap(String propertyPrefix)

public int
public Icon
public MenuItemLayoutHelper.RectSize
public Icon
private int
getCheckOffset(String propertyPrefix)

public MenuItemLayoutHelper.RectSize
public Font
public FontMetrics
public int
public int
public int
public View
private Icon
getIcon(String propertyPrefix)

public Icon
public MenuItemLayoutHelper.RectSize
public MenuItemLayoutHelper.RectSize
private int
getLeadingGap(String propertyPrefix)

public int
private int
public int
public MenuItemLayoutHelper.ColumnAlignment
public JMenuItem
public static JComponent

Returns:

parent of this component if it is not a top-level menu Otherwise returns null.
getMenuItemParent
(JMenuItem
the menu item whose parent will be returned.
menuItem
)

Returns parent of this component if it is not a top-level menu Otherwise returns null.

public JComponent
private int
getMinTextOffset(String propertyPrefix)

public int
protected int

Returns:

value of the property as int.
getParentIntProperty
(Object
name of the parent property.
propertyName
)

Returns parent client property as int.

public MenuItemLayoutHelper.ColumnAlignment
public String
public MenuItemLayoutHelper.RectSize
public int
public int
public Rectangle
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.

public boolean
public boolean
public boolean
protected void
public MenuItemLayoutHelper.LayoutResult
layoutMenuItem()

Layout icon, text, check icon, accelerator text and arrow icon in the viewRect and return their positions.

public static int

Returns:

maximal value.
max
(int...
array where the search will be performed.
values
)

Finds and returns maximal integer value in the given array.

protected void
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
protected void
protected void
setAccText(String accText)

protected void
setAfterCheckIconGap(int afterCheckIconGap)

protected void
setArrowIcon(Icon arrowIcon)

protected void
protected void
setCheckIcon(Icon checkIcon)

protected void
protected void
setColumnLayout(boolean columnLayout)

protected void
setFont(Font font)

protected void
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
protected void
protected void
setLeadingGap(int leadingGap)

protected void
setLeftToRight(boolean leftToRight)

protected void
protected void
protected void
setMinTextOffset(int minTextOffset)

private void
protected void
protected void
protected void
setTopLevelMenu(boolean topLevelMenu)

protected void
setUseCheckAndArrow(boolean useCheckAndArrow)

protected void
setVerticalAlignment(int verticalAlignment)

protected void
setVerticalTextPosition(int verticalTextPosition)

protected void
public boolean
public static boolean
useCheckAndArrow(JMenuItem menuItem)

Returns false if the component is a JMenu and it is a top level menu (on the menubar).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait