本文整理汇总了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();
}
示例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();
}
示例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);
}
示例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;
});
}