当前位置: 首页>>代码示例>>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;未经允许,请勿转载。