本文整理汇总了Java中javafx.scene.control.MenuItem.setDisable方法的典型用法代码示例。如果您正苦于以下问题:Java MenuItem.setDisable方法的具体用法?Java MenuItem.setDisable怎么用?Java MenuItem.setDisable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.control.MenuItem
的用法示例。
在下文中一共展示了MenuItem.setDisable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setEnabled
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
public void setEnabled(boolean b) {
for (Button button : buttons) {
button.setDisable(!b);
}
for (MenuItem menuItem : menuItems) {
menuItem.setDisable(!b);
}
}
示例2: getWSMenu
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
private Menu getWSMenu() {
Menu result = new Menu("WSP");
MenuItem editWSPItem = new MenuItem("Edit WSP...", AssetsLoader.getIcon("edit.png"));
MenuItem connectItem = new MenuItem("Sign in...", AssetsLoader.getIcon("discord_icon.png"));
orgManagerItem = new MenuItem("Organization manager...", AssetsLoader.getIcon("wsp_icon.png"));
orgManagerItem.setDisable(true);
connectItem.setOnAction(this::connectToWSPAction);
editWSPItem.setOnAction(this::editWSPAction);
orgManagerItem.setOnAction(this::organizationManagerAction);
result.getItems().add(connectItem);
result.getItems().add(orgManagerItem);
result.getItems().add(editWSPItem);
cam.getWspConnectionRequiredMenuItems().add(orgManagerItem);
cam.getWspNotConnectedRequiredMenuItems().add(connectItem);
cam.getWspNotConnectedRequiredMenuItems().add(editWSPItem);
return result;
}
示例3: createURLLink
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
private void createURLLink(String pattern, String id, String icon) {
MenuItem tmsMenuItem = new MenuItem(id, FXUIUtils.getIcon(icon));
if (pattern != null && pattern.length() > 0) {
String url = String.format(pattern, id);
tmsMenuItem.setOnAction((event) -> {
try {
Desktop.getDesktop().browse(new URI(url));
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
}
});
} else {
tmsMenuItem.setDisable(true);
}
infoButton.getItems().add(tmsMenuItem);
}
示例4: addContext
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
private ContextMenu addContext(Path path) {
MenuItem createFile = new MenuItem("Create File");
MenuItem createFolder = new MenuItem("Create Folder");
MenuItem copy = new MenuItem("Copy");
MenuItem cut = new MenuItem("Cut");
MenuItem paste = new MenuItem("Paste");
MenuItem rename = new MenuItem("Rename");
MenuItem delete = new MenuItem("Delete");
if (!Files.isDirectory(path)) {
createFile.setDisable(true);
createFolder.setDisable(true);
paste.setDisable(true);
} else if (path.equals(project.getPath())) {
cut.setDisable(true);
copy.setDisable(true);
delete.setDisable(true);
}
createFile.setOnAction(event -> places.runCreateFilePlace(path));
createFolder.setOnAction(event -> places.runCreateFolderPlace(path));
copy.setOnAction(event -> {
commandPath.setCommand("Copy");
commandPath.setPath(path);
});
cut.setOnAction(event -> {
commandPath.setCommand("Cut");
commandPath.setPath(path);
});
PasteEvent pasteEvent = new PasteEvent(commandPath, path);
paste.setOnAction(pasteEvent);
rename.setOnAction(event -> {
if (Files.isDirectory(path)) {
places.runRenameFilePlace(path);
} else {
places.runRenameFolderPlace(path);
}
});
delete.setOnAction(event -> project.deleteFile(path));
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems()
.addAll(createFile, createFolder,
new SeparatorMenuItem(),
copy, cut, paste,
new SeparatorMenuItem(),
rename,
new SeparatorMenuItem(),
delete);
return contextMenu;
}
示例5: menuLabel
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
/**
* Creates a disabled menu item for use as a label.
*
* @param text the text of the label
*/
public static MenuItem menuLabel(String text) {
MenuItem menuItem = new MenuItem(text);
menuItem.setDisable(true);
return menuItem;
}
示例6: SpecificationController
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
/**
* This creates an instance of the controller.
*
* @param typeContext available types in code
* @param codeIoVariables available variables in code
* @param hybridSpecification specification that should be represented by this controller
* @param stateProperty the state of the verification
* @param codeInvalid Tells if the code is valid
* @param globalConfig Global config object
*/
public SpecificationController(ObjectProperty<List<Type>> typeContext,
ObjectProperty<List<CodeIoVariable>> codeIoVariables, HybridSpecification hybridSpecification,
ObjectProperty<VerificationState> stateProperty, BooleanBinding codeInvalid,
GlobalConfig globalConfig) {
this.spec = hybridSpecification;
this.hybridSpecification = hybridSpecification;
this.stateProperty = stateProperty;
this.stateProperty.addListener(this::onVerificationStateChanged);
this.view = new SpecificationView();
this.selection = hybridSpecification.getSelection();
this.globalConfig = globalConfig;
this.variableCollectionController =
new VariableCollectionController(typeContext, hybridSpecification.getFreeVariableList());
this.tableController = new SpecificationTableController(globalConfig, typeContext,
codeIoVariables, variableCollectionController.getValidator().validFreeVariablesProperty(),
hybridSpecification);
this.specificationInvalid = new SimpleBooleanProperty(true);
specificationInvalid.bind(variableCollectionController.getValidator().validProperty().not()
.or(tableController.getValidator().validProperty().not()).or(codeInvalid));
this.specificationConcretizable = new SimpleBooleanProperty(true);
specificationConcretizable
.bind(tableController.getValidator().validSpecificationProperty().isNotNull());
this.concretizationHandler = new ConcretizationTaskHandler();
// use event trigger to generate timing-diagram, to minimize code-duplication
onConcreteInstanceChanged(getConcreteSpecification());
view.setVariableCollection(variableCollectionController.getView());
view.getVariableCollection().getFreeVariableTableView()
.setEditable(this.hybridSpecification.isEditable());
List<MenuItem> freeVarMenuItems =
view.getVariableCollection().getFreeVariableTableView().getContextMenu().getItems();
for (MenuItem menuItem : freeVarMenuItems) {
menuItem.setDisable(!this.hybridSpecification.isEditable());
}
view.setTable(tableController.getView());
view.getStartButton().setOnAction(this::onVerificationButtonClicked);
view.getStartButton().disableProperty().bind(specificationInvalid);
view.getStartConcretizerButton().disableProperty().bind(specificationConcretizable.not());
view.getStartConcretizerButton().setOnAction(this::startConcretizer);
hybridSpecification.concreteInstanceProperty()
.addListener((observable, old, newVal) -> this.onConcreteInstanceChanged(newVal));
registerTimingDiagramDeactivationHandler();
}
示例7: setMenuItemDisable
import javafx.scene.control.MenuItem; //导入方法依赖的package包/类
/**
* set the disable state of the menu item with the given id
*
* @param id
* @param state
*/
public void setMenuItemDisable(String id, boolean state) {
MenuItem menuItem = getMenuItem(id);
if (menuItem != null)
menuItem.setDisable(state);
}