當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuItem.setDisable方法代碼示例

本文整理匯總了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);
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:9,代碼來源:AbstractSimpleAction.java

示例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;
}
 
開發者ID:ScreachFr,項目名稱:titanium,代碼行數:25,代碼來源:MainPane.java

示例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);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:ACEEditor.java

示例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;
}
 
開發者ID:MrChebik,項目名稱:Coconut-IDE,代碼行數:58,代碼來源:CustomTreeCell.java

示例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;
}
 
開發者ID:wpilibsuite,項目名稱:shuffleboard,代碼行數:11,代碼來源:FxUtils.java

示例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();
}
 
開發者ID:VerifAPS,項目名稱:stvs,代碼行數:56,代碼來源:SpecificationController.java

示例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);
}
 
開發者ID:BITPlan,項目名稱:can4eve,代碼行數:12,代碼來源:JavaFXDisplay.java


注:本文中的javafx.scene.control.MenuItem.setDisable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。