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

javajs.swing.JMenuItem Maven / Gradle / Ivy

There is a newer version: 14.31.10
Show newest version
package javajs.swing;

public class JMenuItem extends AbstractButton {

  public final int btnType;
  
  public static final int TYPE_SEPARATOR = 0;
  public static final int TYPE_BUTTON = 1;
  public static final int TYPE_CHECKBOX = 2;
  public static final int TYPE_RADIO = 3;
  public static final int TYPE_MENU = 4;


  public JMenuItem(String text) {
    super("btn");
    setText(text);
    btnType = (text == null ? 0 : 1);
  }

  public JMenuItem(String type, int i) {
    super(type);
    btnType = i;
  }

  @Override
  public String toHTML() {
    return htmlMenuOpener("li")
        + (text == null ? "" : "" + htmlLabel() + "") + "";
  }

  @Override
  protected String getHtmlDisabled() {
    return " class=\"ui-state-disabled\"";  
  }

  private String htmlLabel() {
    return (btnType == TYPE_BUTTON ? text 
        : "");
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy