javafx.scene.control.MenuItem.textProperty()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中javafx.scene.control.MenuItem.textProperty()方法的一些代码示例,展示了MenuItem.textProperty()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.textProperty()方法的具体详情如下:
包路径:javafx.scene.control.MenuItem
类名称:MenuItem
方法名:textProperty

暂无

代码示例

代码示例来源:origin: pmd/pmd

@Override
protected void beforeParentInit() {
  try {
    SettingsPersistenceUtil.restoreProperties(this, DesignerUtil.getSettingsFile());
  } catch (Exception e) {
    // shouldn't prevent the app from opening
    // in case the file is corrupted, it will be overwritten on shutdown
    e.printStackTrace();
  }
  initializeViewAnimation();
  licenseMenuItem.setOnAction(e -> showLicensePopup());
  openFileMenuItem.setOnAction(e -> onOpenFileClicked());
  openRecentMenu.setOnAction(e -> updateRecentFilesMenu());
  openRecentMenu.setOnShowing(e -> updateRecentFilesMenu());
  fileMenu.setOnShowing(e -> onFileMenuShowing());
  setupAuxclasspathMenuItem.setOnAction(e -> sourceEditorController.showAuxclasspathSetupPopup(designerRoot));
  openEventLogMenuItem.setOnAction(e -> eventLogController.getValue().showPopup());
  openEventLogMenuItem.textProperty().bind(
    designerRoot.getLogger().numNewLogEntriesProperty().map(i -> "Exception log (" + (i > 0 ? i : "no") + " new)")
  );
}

代码示例来源:origin: org.drombler.commons/drombler-commons-action-fx

/**
 * Configures a {@link MenuItem} with the specified action.
 *
 * @param menuItem the menu item to configre
 * @param action the action
 * @param iconSize the icon size
 */
public static void configureMenuItem(MenuItem menuItem, FXAction action, int iconSize) {
  menuItem.setMnemonicParsing(true);
  menuItem.textProperty().bind(action.displayNameProperty());
  menuItem.acceleratorProperty().bind(action.acceleratorProperty());
  menuItem.setOnAction(action);
  menuItem.disableProperty().bind(action.enabledProperty().not());
  if (action.getGraphicFactory() != null) {
    Node graphic = action.getGraphicFactory().createGraphic(iconSize);
    if (graphic != null) {
      menuItem.setGraphic(graphic);
    }
  }
}

代码示例来源:origin: org.controlsfx/controlsfx

private static void unconfigure(final MenuItem menuItem) {
  if (menuItem == null || !(menuItem.getOnAction() instanceof Action)) {
    return;
  }
  Action action = (Action) menuItem.getOnAction();
  menuItem.styleProperty().unbind();
  menuItem.textProperty().unbind();
  menuItem.disableProperty().unbind();
  menuItem.acceleratorProperty().unbind();
  menuItem.graphicProperty().unbind();
  action.getProperties().removeListener(new MenuItemPropertiesMapChangeListener<>(menuItem, action));
  if (menuItem instanceof RadioMenuItem) {
    ((RadioMenuItem) menuItem).selectedProperty().unbindBidirectional(action.selectedProperty());
  } else if (menuItem instanceof CheckMenuItem) {
    ((CheckMenuItem) menuItem).selectedProperty().unbindBidirectional(action.selectedProperty());
  }
  menuItem.setOnAction(null);
}

代码示例来源:origin: org.controlsfx/controlsfx

menuItem.textProperty().bind(action.textProperty());
menuItem.disableProperty().bind(action.disabledProperty());
menuItem.acceleratorProperty().bind(action.acceleratorProperty());

相关文章