All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.croesch.components.CMenuItem Maven / Gradle / Ivy

There is a newer version: 1.3
Show newest version
package com.github.croesch.components;

import javax.swing.Action;
import javax.swing.Icon;
import javax.swing.JMenuItem;

import com.github.croesch.util.MnemonicUtil;

/**
 * This menu item is able to set its mnemonic key automatically.
 * 
 * @author croesch
 * @since (Date: 2010/12/20 17:40:58)
 */
public class CMenuItem extends JMenuItem {

  /** serial version UID */
  private static final long serialVersionUID = 3614702957338710920L;

  /**
   * Simply calls {@link JMenuItem#JMenuItem()}
   * 
   * @see JMenuItem#JMenuItem()
   */
  public CMenuItem() {
    super();
  }

  /**
   * Simply calls {@link JMenuItem#JMenuItem(Icon)}
   * 
   * @see JMenuItem#JMenuItem(Icon)
   * @param icon the parameter Icon that is given to superclass constructor
   */
  public CMenuItem(final Icon icon) {
    super(icon);
  }

  /**
   * Simply calls {@link JMenuItem#JMenuItem(String)}
   * 
   * @see JMenuItem#JMenuItem(String)
   * @param text the parameter String that is given to superclass constructor
   */
  public CMenuItem(final String text) {
    super(text);
  }

  /**
   * Simply calls {@link JMenuItem#JMenuItem(Action)}
   * 
   * @see JMenuItem#JMenuItem(Action)
   * @param a the parameter Action that is given to superclass constructor
   */
  public CMenuItem(final Action a) {
    super(a);
  }

  /**
   * Simply calls {@link JMenuItem#JMenuItem(String, Icon)}
   * 
   * @see JMenuItem#JMenuItem(String, Icon)
   * @param text the parameter String that is given to superclass constructor
   * @param icon the parameter Icon that is given to superclass constructor
   */
  public CMenuItem(final String text, final Icon icon) {
    super(text, icon);
  }

  /**
   * Simply calls {@link JMenuItem#JMenuItem(String, int)}
   * 
   * @see JMenuItem#JMenuItem(String, int)
   * @param text the parameter String that is given to superclass constructor
   * @param mnemonic the parameter int that is given to superclass constructor
   */
  public CMenuItem(final String text, final int mnemonic) {
    super(text, mnemonic);
  }

  @Override
  public void setText(final String text) {
    super.setText(MnemonicUtil.filterMnemonic(text, this));
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy