Example usage for javax.swing JMenuItem setVerticalTextPosition

List of usage examples for javax.swing JMenuItem setVerticalTextPosition

Introduction

In this page you can find the example usage for javax.swing JMenuItem setVerticalTextPosition.

Prototype

@BeanProperty(visualUpdate = true, enumerationValues = { "SwingConstants.TOP", "SwingConstants.CENTER",
        "SwingConstants.BOTTOM" }, description = "The vertical position of the text relative to the icon.")
public void setVerticalTextPosition(int textPosition) 

Source Link

Document

Sets the vertical position of the text relative to the icon.

Usage

From source file:Main.java

/**
 * Creates a suitable menu item.//w w  w  .  j a  v  a2  s . co  m
 * 
 * @param action
 * @return
 */
public static JMenuItem createMenuItem(Action action) {
    final JMenuItem mi;
    final Boolean selected = (Boolean) action.getValue(Action.SELECTED_KEY);
    if (selected != null) {
        mi = new JCheckBoxMenuItem(action);
    } else {
        mi = new JMenuItem(action);
    }
    mi.setHorizontalTextPosition(JButton.TRAILING);
    mi.setVerticalTextPosition(JButton.CENTER);
    return mi;
}