Example usage for javax.swing JCheckBoxMenuItem getAccessibleContext

List of usage examples for javax.swing JCheckBoxMenuItem getAccessibleContext

Introduction

In this page you can find the example usage for javax.swing JCheckBoxMenuItem getAccessibleContext.

Prototype

@BeanProperty(bound = false)
public AccessibleContext getAccessibleContext() 

Source Link

Document

Gets the AccessibleContext associated with this JCheckBoxMenuItem.

Usage

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Creates a Localized JCheckBoxMenuItem.
 * @param labelKey//from w  w w  . ja  v a 2s  .c  om
 * @param mnemonicKey
 * @param accessibleDescriptionKey
 * @param enabled
 * @param action
 * @return
 */
public static JCheckBoxMenuItem createLocalizedCheckBoxMenuItem(final String labelKey, final String mnemonicKey,
        final String accessibleDescriptionKey, final boolean enabled, final AbstractAction action) {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(getResourceString(labelKey));
    setLocalizedMnemonic(mi, getResourceString(mnemonicKey));

    if (isNotEmpty(accessibleDescriptionKey)) {
        mi.getAccessibleContext().setAccessibleDescription(getResourceString(accessibleDescriptionKey));
    }
    if (action != null) {
        mi.addActionListener(action);
        action.addPropertyChangeListener(new MenuItemPropertyChangeListener(mi));
        action.setEnabled(enabled);
    }

    return mi;
}

From source file:edu.ku.brc.ui.UIHelper.java

/**
 * Creates a JCheckBoxMenuItem.//from   www . jav  a2s .  c  o  m
 * @param menu parent menu
 * @param label the label of the menu item
 * @param mnemonic the mnemonic
 * @param accessibleDescription the accessible Description
 * @param enabled enabled
 * @param action the aciton
 * @return menu item
 */
public static JCheckBoxMenuItem createCheckBoxMenuItem(final JMenu menu, final String label,
        final String mnemonic, final String accessibleDescription, final boolean enabled,
        final AbstractAction action) {
    JCheckBoxMenuItem mi = new JCheckBoxMenuItem(getResourceString(label));
    if (menu != null) {
        menu.add(mi);
    }
    setLocalizedMnemonic(mi, mnemonic);

    if (isNotEmpty(accessibleDescription)) {
        mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
    }
    if (action != null) {
        mi.addActionListener(action);
        action.addPropertyChangeListener(new MenuItemPropertyChangeListener(mi));
        action.setEnabled(enabled);
    }

    return mi;
}