Package javafx.scene.control

Examples of javafx.scene.control.RadioMenuItem


        menu.getItems().toArray(new RadioMenuItem[]{}) : new RadioMenuItem[]{};
    final List<MenuItem> its = new ArrayList<MenuItem>();
    boolean duplicate = false;
    for (final Object ic : itemContents) {
      duplicate = false;
      final RadioMenuItem mi = new RadioMenuItem(ic == null ? "" : ic.toString());
      for (final RadioMenuItem ei : existingMenuItems) {
        if (ei.getText().equals(mi.getText())) {
          duplicate = true;
          break;
        }
      }
      if (!duplicate) {
        mi.setId("choice-box-menu-item");
        mi.setToggleGroup(toggleGroup);
        mi.setOnAction(new EventHandler<ActionEvent>() {
          public void handle(final ActionEvent event) {
            setSelectionText(((MenuItem)event.getSource()).getText());
          }
        });
        its.add(mi);
View Full Code Here


   */
  protected void selectOrRemove(final Object itemContent, final boolean remove) {
    final RadioMenuItem[] existingMenuItems = menu.getItems() != null ?
        menu.getItems().toArray(new RadioMenuItem[]{}) : new RadioMenuItem[]{};
    String meuContent;
    RadioMenuItem removeItem = null;
    for (final RadioMenuItem ei : existingMenuItems) {
      meuContent = itemContent != null ? itemContent.toString() : null;
      if (meuContent != null && !meuContent.isEmpty() && meuContent.equals(ei.getText())) {
        if (remove) {
          removeItem = ei;
        } else {
          ei.setSelected(true);
          setSelectionText(ei.getText());
        }
      } else {
        ei.setSelected(false);
      }
    }
    if (removeItem != null) {
      menu.getItems().remove(removeItem);
      if (itemContent.equals(removeItem.getText())) {
        setSelectionText(null);
      }
    }
  }
View Full Code Here

    private MenuItem internalCreateWidget() {
      switch (type) {
      case CHECK:
        return new CheckMenuItem();
      case RADIO:
        return new RadioMenuItem(null);
      default:
        return new MenuItem();
      }
    }
View Full Code Here

        CheckMenuItem c = (CheckMenuItem) getWidget();
        if( c.isSelected() != selected ) {
          c.setSelected(selected);
        }
      } else if( getWidget() instanceof RadioMenuItem ) {
        RadioMenuItem r = (RadioMenuItem) getWidget();
        if( r.isSelected() != selected ) {
          r.setSelected(selected);
        }
      }
    }
View Full Code Here

TOP

Related Classes of javafx.scene.control.RadioMenuItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.