本文整理了Java中javafx.scene.control.MenuItem.setDisable()
方法的一些代码示例,展示了MenuItem.setDisable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MenuItem.setDisable()
方法的具体详情如下:
包路径:javafx.scene.control.MenuItem
类名称:MenuItem
方法名:setDisable
暂无
代码示例来源:origin: torakiki/pdfsam
private void disableRemoveMenuItemIfNeeded() {
removeSelected.setDisable(isEmpty(field.getTextField().getText()));
}
代码示例来源:origin: torakiki/pdfsam
private MenuItem createMenuItem(String text, MaterialDesignIcon icon) {
MenuItem item = new MenuItem(text);
MaterialDesignIconFactory.get().setIcon(item, icon, "1.1em");
item.setDisable(true);
return item;
}
代码示例来源:origin: torakiki/pdfsam
private MenuItem createMenuItem(String text, MaterialDesignIcon icon) {
MenuItem item = new MenuItem(text);
MaterialDesignIconFactory.get().setIcon(item, icon, "1.1em");
item.setDisable(true);
return item;
}
代码示例来源:origin: torakiki/pdfsam
private void setContextMenuDisable(boolean value) {
field.getTextField().getContextMenu().getItems().forEach(i -> i.setDisable(value));
disableRemoveMenuItemIfNeeded();
}
代码示例来源:origin: us.ihmc/ihmc-path-planning-visualizers
public void setMainWindow(Window ownerWindow)
{
this.ownerWindow = ownerWindow;
reloadMenuItem.setDisable(true);
}
代码示例来源:origin: torakiki/pdfsam
private void initTopSectionContextMenu(ContextMenu contextMenu, boolean hasRanges) {
MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"),
MaterialDesignIcon.AIRPLANE_LANDING);
setDestinationItem.setOnAction(e -> eventStudio().broadcast(
requestDestination(getSelectionModel().getSelectedItem().descriptor().getFile(), getOwnerModule()),
getOwnerModule()));
setDestinationItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.ALT_DOWN));
selectionChangedConsumer = e -> setDestinationItem.setDisable(!e.isSingleSelection());
contextMenu.getItems().add(setDestinationItem);
if (hasRanges) {
MenuItem setPageRangesItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set as range for all"),
MaterialDesignIcon.FORMAT_INDENT_INCREASE);
setPageRangesItem.setOnAction(e -> eventStudio().broadcast(
new SetPageRangesRequest(getSelectionModel().getSelectedItem().pageSelection.get()),
getOwnerModule()));
setPageRangesItem.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN));
selectionChangedConsumer = selectionChangedConsumer
.andThen(e -> setPageRangesItem.setDisable(!e.isSingleSelection()));
contextMenu.getItems().add(setPageRangesItem);
}
contextMenu.getItems().add(new SeparatorMenuItem());
}
代码示例来源:origin: torakiki/pdfsam
private void initBottomSectionContextMenu(ContextMenu contextMenu) {
MenuItem copyItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Copy to clipboard"),
MaterialDesignIcon.CONTENT_COPY);
copyItem.setOnAction(e -> copySelectedToClipboard());
MenuItem infoItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Document properties"),
MaterialDesignIcon.INFORMATION_OUTLINE);
infoItem.setOnAction(e -> Platform.runLater(() -> eventStudio()
.broadcast(new ShowPdfDescriptorRequest(getSelectionModel().getSelectedItem().descriptor()))));
MenuItem openFileItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open"),
MaterialDesignIcon.FILE_PDF_BOX);
openFileItem.setOnAction(e -> eventStudio()
.broadcast(new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile())));
MenuItem openFolderItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open Folder"),
MaterialDesignIcon.FOLDER_OUTLINE);
openFolderItem.setOnAction(e -> eventStudio().broadcast(
new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile().getParentFile())));
copyItem.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN));
infoItem.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN));
openFileItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN));
openFolderItem.setAccelerator(
new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN, KeyCombination.ALT_DOWN));
contextMenu.getItems().addAll(new SeparatorMenuItem(), copyItem, infoItem, openFileItem, openFolderItem);
selectionChangedConsumer = selectionChangedConsumer.andThen(e -> {
copyItem.setDisable(e.isClearSelection());
infoItem.setDisable(!e.isSingleSelection());
openFileItem.setDisable(!e.isSingleSelection());
openFolderItem.setDisable(!e.isSingleSelection());
});
}
代码示例来源:origin: torakiki/pdfsam
contextMenu.getItems().add(removeSelected);
selectionChangedConsumer = selectionChangedConsumer
.andThen(e -> removeSelected.setDisable(e.isClearSelection()));
if (canMove) {
MenuItem moveTopSelected = createMenuItem(DefaultI18nContext.getInstance().i18n("Move to Top"),
moveTopSelected.setDisable(!e.canMove(MoveType.TOP));
moveUpSelected.setDisable(!e.canMove(MoveType.UP));
moveDownSelected.setDisable(!e.canMove(MoveType.DOWN));
moveBottomSelected.setDisable(!e.canMove(MoveType.BOTTOM));
});
.andThen(e -> duplicateItem.setDisable(e.isClearSelection()));
代码示例来源:origin: us.ihmc/ihmc-path-planning-visualizers
@FXML
public void reloadPlanarRegion()
{
if (loadedFile == null)
{
reloadMenuItem.setDisable(true);
return;
}
loadAndSubmitPlanarRegions();
}
代码示例来源:origin: com.powsybl/powsybl-gse-util
private void selectionContainsOpenedProjects(List<? extends TreeItem<N>> selectedTreeItems, MenuItem menuItem) {
for (TreeItem<N> item : selectedTreeItems) {
if (item.getValue() instanceof Project && openedProjects.contains(((Project) item.getValue()).getId())) {
menuItem.setDisable(true);
break;
}
}
}
代码示例来源:origin: stackoverflow.com
});
delete.setDisable(root);
contextMenu.getAdd().setOnAction(evt -> {
item.getChildren().add(new TreeItem<>("new item"));
代码示例来源:origin: org.copper-engine/copper-monitoring-client
public MenuItem createShowFormMenuItem() {
MenuItem menuItem = new MenuItem();
menuItem.setText(title);
menuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
createForm().show();
}
});
menuItem.setDisable(!enabled);
return menuItem;
}
代码示例来源:origin: com.powsybl/powsybl-gse-util
private MenuItem createDeleteNodeMenuItem(List<? extends TreeItem<N>> selectedTreeItems) {
MenuItem deleteMenuItem = new MenuItem(RESOURCE_BUNDLE.getString("Delete"), Glyph.createAwesomeFont('\uf1f8').size(ICON_SIZE));
if (selectedTreeItems.size() == 1) {
TreeItem<N> selectedTreeItem = selectedTreeItems.get(0);
N selectedTreeItemValue = selectedTreeItem.getValue();
if (selectedTreeItemValue instanceof Folder) {
Folder folder = (Folder) selectedTreeItemValue;
if (!folder.getChildren().isEmpty()) {
deleteMenuItem.setDisable(true);
}
} else if (selectedTreeItemValue instanceof Project) {
Project project = (Project) selectedTreeItemValue;
if (openedProjects.contains(project.getId())) {
deleteMenuItem.setDisable(true);
}
}
} else {
selectionContainsOpenedProjects(selectedTreeItems, deleteMenuItem);
}
deleteMenuItem.setOnAction(event -> createDeleteAlert(selectedTreeItems));
deleteMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.DELETE));
return deleteMenuItem;
}
代码示例来源:origin: us.ihmc/ihmc-path-planning-visualizers
private void loadAndSubmitPlanarRegions()
{
PlanarRegionsList loadedPlanarRegions = PlanarRegionFileTools.importPlanarRegionData(loadedFile);
directoryChooser.setInitialDirectory(loadedFile.getParentFile());
if (loadedPlanarRegions != null)
{
if (VERBOSE)
PrintTools.info(this, "Loaded planar regions, broadcasting data.");
messager.submitMessage(UIVisibilityGraphsTopics.GlobalReset, true);
messager.submitMessage(UIVisibilityGraphsTopics.PlanarRegionData, loadedPlanarRegions);
messager.submitMessage(UIVisibilityGraphsTopics.StartPosition, new Point3D());
messager.submitMessage(UIVisibilityGraphsTopics.GoalPosition, new Point3D());
reloadMenuItem.setDisable(false);
}
else
{
if (VERBOSE)
PrintTools.info(this, "Failed to load planar regions.");
reloadMenuItem.setDisable(true);
loadedFile = null;
}
}
}
代码示例来源:origin: com.aquafx-project/aquafx
Menu item2 = new Menu("List item 2");
MenuItem item3 = new MenuItem("List item 3");
item3.setDisable(true);
MenuItem item4 = new MenuItem("List Item 4");
item2.getItems().addAll(item3, item4);
item6.setAccelerator(KeyCombination.keyCombination("Alt+shortcut+H"));
MenuItem item7 = new MenuItem("List Item 7");
item7.setDisable(true);
item1.getItems().addAll(new MenuItem("list item 1"), new SeparatorMenuItem(), item2,
new SeparatorMenuItem(), item5, item6, item7);
代码示例来源:origin: org.codehaus.griffon/griffon-javafx
action.enabledProperty().addListener((v, o, n) -> runInsideUIThread(() -> control.setDisable(!n)));
runInsideUIThread(() -> control.setDisable(!action.getEnabled()));
代码示例来源:origin: com.aquafx-project/aquafx
Menu menuServices = new Menu("Dienste");
MenuItem menuNoService = new MenuItem("Keine Dienste Verf\u00FCgbar");
menuNoService.setDisable(true);
MenuItem menuServPref = new MenuItem("Dienste Enistellungen ...");
menuServices.getItems().addAll(menuNoService, menuServPref);
menuHideOthers.setAccelerator(KeyCombination.keyCombination("Alt+shortcut+H"));
MenuItem menuShowAll = new MenuItem("Alle einblenden");
menuShowAll.setDisable(true);
menuSystemPreferences.getItems().addAll(new MenuItem("\u00DCber Systemeinstellungen"), new SeparatorMenuItem(), menuServices,
new SeparatorMenuItem(), menuHide, menuHideOthers, menuShowAll, new MenuItem("Systemeinstellungen beenden"));
代码示例来源:origin: com.aquafx-project/aquafx
Menu menuServices = new Menu("Dienste");
MenuItem menuNoService = new MenuItem("Keine Dienste Verf\u00FCgbar");
menuNoService.setDisable(true);
menuHideOthers.setAccelerator(KeyCombination.keyCombination("Alt+shortcut+H"));
MenuItem menuShowAll = new MenuItem("Alle einblenden");
menuShowAll.setDisable(true);
menuSystemPreferences.getItems().addAll(new MenuItem("\u00DCber Systemeinstellungen"), new SeparatorMenuItem(), menuServices,
new SeparatorMenuItem(), menuHide, menuHideOthers, menuShowAll, new MenuItem("Systemeinstellungen beenden"));
内容来源于网络,如有侵权,请联系作者删除!