Ejemplo n.º 1
0
  /**
   * Create a checkbox item
   *
   * @param callback the associated callback
   * @return the checkbox item
   */
  protected static CheckBoxMenuItem createCheckBoxMenu(CommonCallBack callback) {
    CheckBoxMenuItem item = ScilabCheckBoxMenuItem.createCheckBoxMenuItem();

    SwingScilabCheckBoxMenuItem swingItem =
        (SwingScilabCheckBoxMenuItem) item.getAsSimpleCheckBoxMenuItem();
    swingItem.setAction(callback);

    return item;
  }
Ejemplo n.º 2
0
 /**
  * Set if the Menu is checked or not
  *
  * @param status true if the Menu is checked
  */
 public void setChecked(boolean status) {
   checkedState = status;
   if (meAsACheckBoxMenuItem == null) {
     meAsACheckBoxMenuItem = ScilabCheckBoxMenuItem.createCheckBoxMenuItem(autoCheckedMode);
     meAsACheckBoxMenuItem.setText(getText());
     meAsACheckBoxMenuItem.setChecked(status);
     meAsACheckBoxMenuItem.setCallback(getCallback());
     Container parent = getParent();
     int index = parent.getComponentZOrder(this);
     parent.remove(this.getComponent());
     parent.add(
         (SwingScilabCheckBoxMenuItem) meAsACheckBoxMenuItem.getAsSimpleCheckBoxMenuItem(), index);
   } else {
     meAsACheckBoxMenuItem.setChecked(status);
   }
 }