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

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

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

暂无

代码示例

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

public static void setGraphic(@Nonnull MenuItem control, @Nullable Node graphic) {
  requireNonNull(control, ERROR_CONTROL_NULL);
  runInsideUIThread(() -> {
    if (graphic != null) {
      control.graphicProperty().set(graphic);
    } else {
      control.graphicProperty().set(null);
    }
  });
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

public static void setGraphic(@Nonnull MenuItem control, @Nullable Image graphic) {
  requireNonNull(control, ERROR_CONTROL_NULL);
  runInsideUIThread(() -> {
    if (graphic != null) {
      Node graphicNode = new ImageView(graphic);
      control.graphicProperty().set(graphicNode);
    } else {
      control.graphicProperty().set(null);
    }
  });
}

代码示例来源:origin: org.codehaus.griffon/griffon-javafx

public static void setIcon(@Nonnull MenuItem control, @Nonnull String iconUrl) {
  requireNonNull(control, ERROR_CONTROL_NULL);
  requireNonBlank(iconUrl, ERROR_ICON_BLANK);
  Node graphicNode = resolveIcon(iconUrl);
  if (graphicNode != null) {
    runInsideUIThread(() -> control.graphicProperty().set(graphicNode));
  }
}

代码示例来源: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.acceleratorProperty().bind(action.acceleratorProperty());
menuItem.graphicProperty().bind(new ObjectBinding<Node>() {
  { bind(action.graphicProperty()); }

相关文章