Java JCheckBoxMenuItem configureJCheckBoxMenuItem( final JCheckBoxMenuItem mi, final Action a)

Here you can find the source of configureJCheckBoxMenuItem( final JCheckBoxMenuItem mi, final Action a)

Description

Configures a JCheckBoxMenuItem for an Action.

License

Open Source License

Declaration

public static void configureJCheckBoxMenuItem(
        final JCheckBoxMenuItem mi, final Action a) 

Method Source Code

//package com.java2s;
/*//from  ww w .j  a v a2 s .  c o m
 * @(#)ActionUtil.java
 *
 * Copyright (c) 1996-2010 by the original authors of JHotDraw and all its
 * contributors. All rights reserved.
 *
 * You may not use, copy or modify this file, except in compliance with the 
 * license agreement you entered into with the copyright holders. For details
 * see accompanying license terms.
 */

import javax.swing.*;

public class Main {
    /**
     * Configures a JCheckBoxMenuItem for an Action.
     */
    public static void configureJCheckBoxMenuItem(
            final JCheckBoxMenuItem mi, final Action a) {
        /*mi.setSelected((Boolean) a.getValue(ActionUtil.SELECTED_KEY));
        PropertyChangeListener propertyHandler = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                if (evt.getPropertyName().equals(ActionUtil.SELECTED_KEY)) {
                    mi.setSelected((Boolean) a.getValue(ActionUtil.SELECTED_KEY));
                }
            }
        };
        a.addPropertyChangeListener(propertyHandler);
        mi.putClientProperty("actionPropertyHandler", propertyHandler);
         */
        mi.setAction(a);
    }
}

Related

  1. createCheckBoxMenuItem(final JInternalFrame f)
  2. createCheckBoxMenuItem(final String text, final boolean selected)
  3. createCheckBoxMenuItem(String label, int mnemonic, String description, ItemListener action)
  4. createCheckBoxMenuItem(String text, Icon icon, String toolTip, ActionListener... listeners)