static void paint(SeaGlassContext context, SeaGlassContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon,
boolean useCheckAndArrow, String acceleratorDelimiter, int defaultTextIconGap) {
JComponent c = context.getComponent();
JMenuItem b = (JMenuItem) c;
ButtonModel model = b.getModel();
Insets i = b.getInsets();
resetRects();
viewRect.setBounds(0, 0, b.getWidth(), b.getHeight());
viewRect.x += i.left;
viewRect.y += i.top;
viewRect.width -= (i.right + viewRect.x);
viewRect.height -= (i.bottom + viewRect.y);
SynthStyle style = context.getStyle();
Font f = style.getFont(context);
g.setFont(f);
FontMetrics fm = SwingUtilities2.getFontMetrics(c, g, f);
FontMetrics accFM = SwingUtilities2.getFontMetrics(c, g, accContext.getStyle().getFont(accContext));
// get Accelerator text
KeyStroke accelerator = b.getAccelerator();
String acceleratorText = "";
if (accelerator != null) {
int modifiers = accelerator.getModifiers();
if (modifiers > 0) {
acceleratorText = KeyEvent.getKeyModifiersText(modifiers);
acceleratorText += acceleratorDelimiter;
}
int keyCode = accelerator.getKeyCode();
if (keyCode != 0) {
acceleratorText += KeyEvent.getKeyText(keyCode);
} else {
acceleratorText += accelerator.getKeyChar();
}
}
// layoutl the text and icon
String text = layoutMenuItem(context, fm, accContext, b.getText(), accFM, acceleratorText, b.getIcon(), checkIcon, arrowIcon, b
.getVerticalAlignment(), b.getHorizontalAlignment(), b.getVerticalTextPosition(), b.getHorizontalTextPosition(), viewRect,
iconRect, textRect, acceleratorRect, checkIconRect, arrowIconRect, b.getText() == null ? 0 : defaultTextIconGap,
defaultTextIconGap, useCheckAndArrow);
// Paint the Check
if (checkIcon != null && useCheckAndArrow) {
SeaGlassIcon.paintIcon(checkIcon, context, g, checkIconRect.x, checkIconRect.y, checkIconRect.width, checkIconRect.height);
}
// Paint the Icon
if (b.getIcon() != null) {
Icon icon;
if (!model.isEnabled()) {
icon = (Icon) b.getDisabledIcon();
} else if (model.isPressed() && model.isArmed()) {
icon = (Icon) b.getPressedIcon();
if (icon == null) {
// Use default icon
icon = (Icon) b.getIcon();
}