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


Java MenuItem.setText方法代碼示例

本文整理匯總了Java中javafx.scene.control.MenuItem.setText方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuItem.setText方法的具體用法?Java MenuItem.setText怎麽用?Java MenuItem.setText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.scene.control.MenuItem的用法示例。


在下文中一共展示了MenuItem.setText方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rebuildAddItemMenu

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
private void rebuildAddItemMenu() {
    Station station = conjunction.getFormula().getContext().getStation();
    addEntry.getItems().clear();
    for(String id : station.getFilters().keySet()) {
        MenuItem item = new MenuItem();
        item.setText(id);

        item.setOnAction(event -> {
            if(!content.getItems().contains(id)) {
                content.getItems().add(id);
            }
        });

        addEntry.getItems().add(item);
    }
}
 
開發者ID:rumangerst,項目名稱:CSLMusicModStationCreator,代碼行數:17,代碼來源:ConjunctionEditor.java

示例2: createMenuItem

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
public static MenuItem createMenuItem(String name, String commandName, String mnemonic) {
    MenuItem menuItem = new MenuItem();
    menuItem.setId(name + "MenuItem");
    Node enabledIcon = getImageFrom(name, "icons/", FromOptions.NULL_IF_NOT_EXISTS);
    if (enabledIcon != null) {
        menuItem.setGraphic(enabledIcon);
    }
    menuItem.setText(commandName);
    if (!"".equals(mnemonic)) {
        menuItem.setAccelerator(KeyCombination.keyCombination(mnemonic));
    }

    return menuItem;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:15,代碼來源:FXUIUtils.java

示例3: createCheckboxMenuItem

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
public static MenuItem createCheckboxMenuItem(String name, String commandName, String mnemonic) {
    MenuItem menuItem = new CheckMenuItem();
    menuItem.setId(name + "MenuItem");
    Node enabledIcon = getImageFrom(name, "icons/", FromOptions.NULL_IF_NOT_EXISTS);
    if (enabledIcon != null) {
        menuItem.setGraphic(enabledIcon);
    }
    menuItem.setText(commandName);
    if (!"".equals(mnemonic)) {
        menuItem.setAccelerator(KeyCombination.keyCombination(mnemonic));
    }
    return menuItem;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:14,代碼來源:FXUIUtils.java

示例4: getSimpleMenuItem

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
public static MenuItem getSimpleMenuItem(String text, Node graphic, Consumer<ActionEvent> eventHandler) {
  MenuItem item = new MenuItem();
  if (text != null) {
    item.setText(text);
  }
  if (graphic != null) {
    item.setGraphic(graphic);
  }
  if (eventHandler != null) {
    item.setOnAction(eventHandler::accept);
  }
  return item;
}
 
開發者ID:XDean,項目名稱:CSS-Editor-FX,代碼行數:14,代碼來源:Util.java

示例5: getRecentMenuItemPair

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
private Pair<File, MenuItem> getRecentMenuItemPair(File file) {
  MenuItem item = new MenuItem();
  item.setText(file.toString());
  item.setOnAction(e -> onAction.accept(file));
  return new Pair<>(file, item);
}
 
開發者ID:XDean,項目名稱:JavaFX-EX,代碼行數:7,代碼來源:RecentFileMenuSupport.java

示例6: initialize

import javafx.scene.control.MenuItem; //導入方法依賴的package包/類
@Override
public void initialize(URL location, ResourceBundle resources)
{
    if (prefs.get(PreferencesKeys.SAVE_PATH.toString(), null) != null)
    {
        try
        {
            userAppList.loadFromXml(new File(prefs.get(PreferencesKeys.SAVE_PATH.toString(), null)));
        } catch (JAXBException | SteamApiException e)
        {
            e.printStackTrace();
        }
    }
    currentAppList = userAppList.getAppList();
    updateListApp();

    /* Define the Table View */
    key.setCellValueFactory(new PropertyValueFactory<>("key"));
    key.setCellFactory(TextFieldTableCell.forTableColumn());
    state.setCellValueFactory(new PropertyValueFactory<>("state"));
    state.setCellFactory(ComboBoxTableCell.forTableColumn(KeyState.values()));
    currentUse.setCellValueFactory(new PropertyValueFactory<>("currentUse"));
    currentUse.setCellFactory(ComboBoxTableCell.forTableColumn(KeyCurrentUse.values()));
    used.setCellValueFactory(new PropertyValueFactory<>("used"));
    used.setCellFactory(CheckBoxTableCell.forTableColumn(used));
    dateAdded.setCellValueFactory(new PropertyValueFactory<>("dateAdded"));
    dateAdded.setCellFactory(TextFieldTableCell.forTableColumn());

    /*Change listener for table view */
    ChangeListener<Object> listener = (obs, oldValue, newValue) ->
            modified = true;
    keyList.focusedProperty().addListener(listener);
    keyList.getSelectionModel().selectedItemProperty().addListener(listener);

    /* Context Menu for the filter button */
    ContextMenu contextMenu = new ContextMenu();
    MenuItem showAll = new MenuItem();
    MenuItem showUsed = new MenuItem();
    showAll.setText(I18n.getMessage("allGame"));
    showUsed.setText(I18n.getMessage("gameWithUsedKey"));
    showAll.setOnAction(event ->
    {
        currentAppList = userAppList.getAppList();
        updateListApp();
        filterMode = false;
    });
    showUsed.setOnAction(event ->
    {
        currentAppList = userAppList.getGamesWithUsedKey();
        updateListApp();
        filterMode = true;
    });
    contextMenu.getItems().addAll(showAll,showUsed);
    filterButton.setContextMenu(contextMenu);
    imageCacheHandler.loadImageCache();

}
 
開發者ID:Matthieu42,項目名稱:Steam-trader-tools,代碼行數:58,代碼來源:AppController.java


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