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


Java CheckMenuItem.setId方法代碼示例

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


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

示例1: MixedItemsMenu

import javafx.scene.control.CheckMenuItem; //導入方法依賴的package包/類
public MixedItemsMenu() {
    super(MIXED_ID);
    setId(MIXED_ID);

    MenuItem graphics_menu_item = new MenuItem(MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_menu_item.setId(MENU_ITEM_GRAPHICS_ID);
    graphics_menu_item.setAccelerator(MENU_ITEM_ACCELERATOR);

    CheckMenuItem graphics_check_menu_item = new CheckMenuItem(CHECK_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_check_menu_item.setId(CHECK_MENU_ITEM_GRAPHICS_ID);
    graphics_check_menu_item.setAccelerator(CHECK_MENU_ITEM_ACCELERATOR);

    RadioMenuItem graphics_radio_menu_item = new RadioMenuItem(RADIO_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_radio_menu_item.setId(RADIO_MENU_ITEM_GRAPHICS_ID);
    graphics_radio_menu_item.setAccelerator(RADIO_MENU_ITEM_ACCELERATOR);

    HBox node_box_bool = new HBox();
    node_box_bool.getChildren().addAll(new Rectangle(10, 10), new Label(NODE_MENU_ITEM_BOOL_ID));
    CustomMenuItem graphics_node_menu_item = new CustomMenuItem(node_box_bool, true);
    graphics_node_menu_item.setId(NODE_MENU_ITEM_BOOL_ID);
    graphics_node_menu_item.setAccelerator(NODE_MENU_ITEM_ACCELERATOR);

    SeparatorMenuItem separator_menu_item = new SeparatorMenuItem();
    separator_menu_item.setId(SEPARATOR_MENU_ITEM_VOID_ID);

    getItems().addAll(graphics_menu_item,
            graphics_check_menu_item,
            graphics_radio_menu_item,
            graphics_node_menu_item,
            separator_menu_item);

    setEventHandlers();
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:34,代碼來源:MenuItemApp.java

示例2: CheckItemsMenu

import javafx.scene.control.CheckMenuItem; //導入方法依賴的package包/類
public CheckItemsMenu() {
    super(CHECK_ID);
    setId(CHECK_ID);

    for (int i = 0; i < 3; i++) {
        CheckMenuItem item = new CheckMenuItem("Item " + i, new Rectangle(10, 10));
        item.setId(item.getText());
        getItems().add(item);
    }
    setEventHandlers();
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:12,代碼來源:MenuItemApp.java

示例3: Constructors

import javafx.scene.control.CheckMenuItem; //導入方法依賴的package包/類
public Constructors() {
    super(CONSTRUCTORS_ID);
    setId(CONSTRUCTORS_ID);

    MenuItem void_menu_item = new MenuItem();
    void_menu_item.setId(MENU_ITEM_VOID_ID);
    MenuItem string_menu_item = new MenuItem(MENU_ITEM_STRING_ID);
    string_menu_item.setId(MENU_ITEM_STRING_ID);
    MenuItem graphics_menu_item = new MenuItem(MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_menu_item.setId(MENU_ITEM_GRAPHICS_ID);

    CheckMenuItem void_check_menu_item = new CheckMenuItem();
    void_check_menu_item.setId(CHECK_MENU_ITEM_VOID_ID);
    CheckMenuItem string_check_menu_item = new CheckMenuItem(CHECK_MENU_ITEM_ID);
    string_check_menu_item.setId(CHECK_MENU_ITEM_ID);
    CheckMenuItem graphics_check_menu_item = new CheckMenuItem(CHECK_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_check_menu_item.setId(CHECK_MENU_ITEM_GRAPHICS_ID);

    RadioMenuItem string_radio_menu_item_parameterless = new RadioMenuItem();
    string_radio_menu_item_parameterless.setId(RADIO_MENU_ITEM_PARAMETERLESS_ID);
    RadioMenuItem string_radio_menu_item = new RadioMenuItem(RADIO_MENU_ITEM_ID);
    string_radio_menu_item.setId(RADIO_MENU_ITEM_ID);
    RadioMenuItem graphics_radio_menu_item = new RadioMenuItem(RADIO_MENU_ITEM_GRAPHICS_ID, new Rectangle(10, 10));
    graphics_radio_menu_item.setId(RADIO_MENU_ITEM_GRAPHICS_ID);

    CustomMenuItem void_node_menu_item = new CustomMenuItem();
    HBox void_node_box = new HBox();
    void_node_box.getChildren().addAll(new Rectangle(10, 10), new Label(NODE_MENU_ITEM_VOID_ID));
    void_node_menu_item.setContent(void_node_box);
    void_node_menu_item.setId(NODE_MENU_ITEM_VOID_ID);
    HBox node_box = new HBox();
    node_box.getChildren().addAll(new Rectangle(10, 10), new Label(NODE_MENU_ITEM_ID));
    CustomMenuItem node_menu_item = new CustomMenuItem(node_box);
    node_menu_item.setId(NODE_MENU_ITEM_ID);
    HBox node_box_bool = new HBox();
    node_box_bool.getChildren().addAll(new Rectangle(10, 10), new Label(NODE_MENU_ITEM_BOOL_ID));
    CustomMenuItem graphics_node_menu_item = new CustomMenuItem(node_box_bool, true);
    graphics_node_menu_item.setId(NODE_MENU_ITEM_BOOL_ID);

    SeparatorMenuItem separator_menu_item = new SeparatorMenuItem();
    separator_menu_item.setId(SEPARATOR_MENU_ITEM_VOID_ID);

    getItems().addAll(void_menu_item, string_menu_item, graphics_menu_item,
            void_check_menu_item, string_check_menu_item, graphics_check_menu_item,
            string_radio_menu_item_parameterless, string_radio_menu_item, graphics_radio_menu_item,
            void_node_menu_item, node_menu_item, graphics_node_menu_item,
            separator_menu_item);
}
 
開發者ID:teamfx,項目名稱:openjfx-8u-dev-tests,代碼行數:49,代碼來源:MenuItemApp.java

示例4: createContextMenu

import javafx.scene.control.CheckMenuItem; //導入方法依賴的package包/類
private void createContextMenu() {
    final ContextMenu contextMenu = new ContextMenu();

    removeTrackerMenuItem.setId(REMOVE_TRACKER);
    removeTrackerMenuItem.setDisable(true);

    updateTrackerMenuItem.setId(UPDATE_TRACKER);
    updateTrackerMenuItem.setDisable(true);

    final CheckMenuItem enableDhtMenuItem = new CheckMenuItem(ENABLE_DHT);
    enableDhtMenuItem.setId(ENABLE_DHT);
    enableDhtMenuItem.setSelected(true);

    final CheckMenuItem enableLocalPeerDiscoveryMenuItem = new CheckMenuItem(ENABLE_LOCAL_PEER_DISCOVERY);
    enableLocalPeerDiscoveryMenuItem.setId(ENABLE_LOCAL_PEER_DISCOVERY);
    enableLocalPeerDiscoveryMenuItem.setSelected(true);

    final CheckMenuItem enablePeerExchangeMenuItem = new CheckMenuItem(ENABLE_PEER_EXCHANGE);
    enablePeerExchangeMenuItem.setId(ENABLE_PEER_EXCHANGE);
    enablePeerExchangeMenuItem.setSelected(true);

    contextMenu.getItems().addAll(updateTrackerMenuItem, removeTrackerMenuItem, new SeparatorMenuItem(),
            addTrackerMenuItem, enableDhtMenuItem, enableLocalPeerDiscoveryMenuItem,
            enablePeerExchangeMenuItem);
    contextMenu.showingProperty().addListener(obs -> {
        removeTrackerMenuItem.setDisable(true);
        updateTrackerMenuItem.setDisable(true);
    });
    trackerTable.setContextMenu(contextMenu);
    trackerTable.setRowFactory(table -> {
        final TableRow<TrackableView> tableRow = new TrackerTableRow<>();
        tableRow.setContextMenu(contextMenu);
        tableRow.setOnContextMenuRequested(cme -> {
            final TrackableView trackableView = tableRow.getItem();
            if(trackableView == null) {
                return;
            }
            final Collection<TrackableView> deletableTrackers = getDeletableTrackers(
                    trackerTable.getSelectionModel().getSelectedItems());
            removeTrackerMenuItem.setDisable(deletableTrackers.isEmpty());
            removeTrackerMenuItem.setText(deletableTrackers.size() > 1? REMOVE_TRACKER + "s" : REMOVE_TRACKER);

            final Collection<TrackableView> updatableTrackers = getUpdatableTrackables(
                    trackerTable.getSelectionModel().getSelectedItems());
            updateTrackerMenuItem.setDisable(updatableTrackers.isEmpty());
            updateTrackerMenuItem.setText(updatableTrackers.size() > 1? UPDATE_TRACKER + "s" : UPDATE_TRACKER);
        });

        return tableRow;
    });
}
 
開發者ID:veroslav,項目名稱:jfx-torrent,代碼行數:52,代碼來源:TrackerTable.java


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