@Override public void initialize(URL arg0, ResourceBundle arg1) { try { person = new FatesPerson(FileData.getInstance().getWorkingFile()); updateList(); } catch (Exception e) { e.printStackTrace(); } ContextMenu contextMenu = new ContextMenu(); addBlock = new MenuItem("Add Block"); removeBlock = new MenuItem("Remove Block"); contextMenu.getItems().add(addBlock); contextMenu.getItems().add(removeBlock); personList.setContextMenu(contextMenu); addListeners(); }
private List<Window> getContextMenu() { List<Window> contextMenus = new ArrayList<>(); new Wait("Unable to context menu") { @Override public boolean until() { @SuppressWarnings({ "deprecation" }) Iterator<Window> windows = Window.impl_getWindows(); while (windows.hasNext()) { Window window = windows.next(); if (window instanceof ContextMenu) { contextMenus.add(window); } } return contextMenus.size() > 0; } }; ; return contextMenus; }
private ConsolePane createConsole() { ConsolePane console = new ConsolePane(); ContextMenu contextMenu = new ContextMenu(); MenuItem clearConsoleItem = new MenuItem("Clear"); clearConsoleItem.setOnAction(e -> console.clear()); contextMenu.getItems().add(clearConsoleItem); console.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> { contextMenu.show(console, event.getScreenX(), event.getScreenY()); event.consume(); }); console.setOnMouseClicked(event -> { if (event.getButton() == MouseButton.PRIMARY) contextMenu.hide(); }); return console; }
@Override public ContextMenu call(ContextMenuParameter param) { DateControl control = param.getDateControl(); ContextMenu contextMenu = null; /* * Check for WeekDayView first because it is a specialization of * DayView. Otherwise we would always return the context menu of * DayView. */ if (control instanceof WeekDayView) { contextMenu = getWeekDayViewMenu(param); } else if (control instanceof DayView) { contextMenu = getDayViewMenu(param); } else if (control instanceof AllDayView) { contextMenu = getAllDayViewMenu(param); } if (contextMenu == null || contextMenu.getItems().isEmpty()) { return null; } return contextMenu; }
/** * Returns the context menu specific for a single {@link WeekDayView}. Week * day views are used inside a {@link WeekView}. * * @param param * parameter object with the most relevant information for * creating a new context menu * @return a context menu for a week day view */ protected ContextMenu getWeekDayViewMenu(ContextMenuParameter param) { ContextMenu contextMenu = getDayViewBaseMenu(param); WeekDayView weekDayView = (WeekDayView) param.getDateControl(); WeekView weekView = weekDayView.getWeekView(); Menu daysMenu = new Menu(Messages.getString("ContextMenuProvider.SHOW_DAYS")); //$NON-NLS-1$ int[] days = new int[]{5, 7, 14, 21, 28}; for (int d : days) { String itemText = MessageFormat.format(Messages.getString("ContextMenuProvider.DAYS"), d); //$NON-NLS-1$ MenuItem item = new MenuItem(itemText); item.setOnAction(evt -> weekView.setNumberOfDays(d)); daysMenu.getItems().add(item); } contextMenu.getItems().add(daysMenu); return contextMenu; }
/** * Returns the context menu specific for an {@link AllDayView}. * * @param param * parameter object with the most relevant information for * creating a new context menu * @return a context menu for an all day view */ protected ContextMenu getAllDayViewMenu(ContextMenuParameter param) { ContextMenu contextMenu = new ContextMenu(); DateControl control = param.getDateControl(); if (control instanceof AllDayView) { MenuItem newEntry = new MenuItem(Messages.getString("ContextMenuProvider.ADD_NEW_EVENT")); //$NON-NLS-1$ newEntry.setOnAction(evt -> { control.createEntryAt(param.getZonedDateTime()); contextMenu.hide(); }); contextMenu.getItems().add(newEntry); } if (contextMenu.getItems().isEmpty()) { return null; } return contextMenu; }
public Button build(String name, Association association) { EventBus eventBus = toolBox.getEventBus(); Button button = new JFXButton(name); button.setUserData(association); button.getStyleClass().add("abpanel-button"); button.setOnAction(event -> { ArrayList<Annotation> annotations = new ArrayList<>(toolBox.getData().getSelectedAnnotations()); eventBus.send(new CreateAssociationsCmd(association, annotations)); }); button.setTooltip(new Tooltip(association.toString())); ContextMenu contextMenu = new ContextMenu(); MenuItem deleteButton = new MenuItem(toolBox.getI18nBundle().getString("cbpanel.conceptbutton.delete")); deleteButton.setOnAction(event -> ((Pane) button.getParent()).getChildren().remove(button)); contextMenu.getItems().addAll(deleteButton); button.setContextMenu(contextMenu); return button; }
private void initTableContextMenu() { TextField textField = new TextField("Type Something"); // we will add a popup menu to this text field contextMenu = new ContextMenu(); MenuItem pauseP = new MenuItem("Stop process"); pauseP.setId("pausep"); MenuItem continueP = new MenuItem("Continue process"); continueP.setId("continuep"); MenuItem killP = new MenuItem("Kill process"); killP.setId("killp"); pauseP.setOnAction(actionEventHandler); continueP.setOnAction(actionEventHandler); killP.setOnAction(actionEventHandler); contextMenu.getItems().addAll(pauseP, continueP, new SeparatorMenuItem(), killP); // ... textField.setContextMenu(contextMenu); }
@Override public void load() { super.load(); Platform.runLater(new Runnable() { // this will run initFX as JavaFX-Thread @Override public void run() { webView.setContextMenuEnabled(false); contextMenu = new ContextMenu(); open = new MenuItem("Open in browser"); addActionListener(); addContextMenuListener(); contextMenu.getItems().addAll(open); } }); }
private void createConextMenu() { MenuItem contextRefresh = new MenuItem("Refresh"); contextRefresh.setOnAction(e->{ buildEntireTree(); expandTreeView(root); }); MenuItem contextOpen = new MenuItem("Open chart"); contextOpen.setOnAction(e->{ openSelectedChart(); }); MenuItem contextCollapse = new MenuItem("Collapse Nodes"); contextCollapse.setOnAction(e->{ collapseTreeView(root); }); contextMenu = new ContextMenu(contextOpen, contextRefresh, contextCollapse); contextMenu.setPrefWidth(250); }
private void configureTextField() { ClampedDoubleStringConverter stringConverter = new ClampedDoubleStringConverter(); stringConverter.setMin(MIN_TIME); stringConverter.setMax(MAX_TIME); stringConverter.setNullValue(DEFAULT_TIME); stringConverter.setDecimalPlaces(-1); stringConverter.setFormat(FORMAT); textField.setTextFormatter(new NonNegativeDoubleTextFormatter()); textField.setContextMenu(new ContextMenu()); TextFieldHelper.bind(textField, textFieldValue, stringConverter, null); TextFieldHelper.executeOnFocusLostOrEnter(textField, () -> { requestFocus(); setEditMode(false); onCommit(); }); }
@Override public ContextMenu getContextMenu() { ContextMenu contextMenu = new ContextMenu(); ObjEntity objectEntity = (ObjEntity) getPropertyAdapter().getWrappedObject(); getPropertyAdapter().getDataMapAdapter().getDatabaseEntityAdapters().stream().forEach(databaseEntity -> { if (StringUtils.equals(databaseEntity.getName(), objectEntity.getDbEntityName())) { MenuItem jumpTo = new MenuItem("Jump To Database Entity: " + databaseEntity.getName()); jumpTo.setMnemonicParsing(false); jumpTo.setOnAction(event -> { LOGGER.debug("Jumping to DB Entity: " + databaseEntity.getName()); }); contextMenu.getItems().add(jumpTo); } }); return contextMenu; }
/** * @param chrome the browser chrome the bookmark is to control. * @param bookmarksMenu the menu into which the bookmark is to be installed. * @param bookmarkName the name of the bookmark. * @param bookmarkUrl the url of the bookmark. * * @return true if the bookmark was not already installed in the chrome, otherwise false. */ public static boolean installBookmark( final Willow chrome, final ContextMenu bookmarksMenu, final String bookmarkName, final String bookmarkUrl ) { for (MenuItem item : bookmarksMenu.getItems()) { if (item.getText().equals(bookmarkName)) { return false; } } final MenuItem menuItem = new MenuItem(bookmarkName); menuItem.setOnAction(actionEvent -> chrome.getBrowser().navTo(bookmarkUrl)); bookmarksMenu.getItems().add(menuItem); return true; }
/** * @return a new context menu for a range of history items. */ private ContextMenu createMenu() { // a menu of history items. final ContextMenu historyMenu = new ContextMenu(); // determine an appropriate subset range of the history list to display. int minIdx = Math.max(0, pointer - 8); // min range (inclusive) of history items to show. int maxIdx = Math.min(items.size(), pointer + 6); // min range (exclusive) of history items to show. // add menu items to the history list. for (int i = maxIdx - 1; i >= minIdx; i--) { final MenuItem nextMenu = createMenuItem(items.get(i), i); historyMenu.getItems().add(nextMenu); if (i == pointer) { nextMenu.getStyleClass().add("current-menu"); } } return historyMenu; }
/** * tbParam 테이블의 컨텍스트 메뉴 적용 * * @작성자 : KYJ * @작성일 : 2015. 10. 22. */ private void tbParamContextMenu() { MenuItem menuItemExtractFromQuery = new MenuItem("Extract from Query"); menuItemExtractFromQuery.setOnAction(this::menuItemExtractFromQueryOnAction); MenuItem menuItemRemove = new MenuItem("Remove Var."); menuItemRemove.setOnAction(this::menuItemRemoveOnAction); // 사실 이 항목은 필요없을것같음. // MenuItem addMenuItem = new MenuItem("Add"); // addMenuItem.setOnAction(this::addMenuParamOnAction); // MenuItem deleteMenuItem = new MenuItem("Delete"); // deleteMenuItem.setOnAction(this::deleteMenuParamOnAction); tbParams.setContextMenu(new ContextMenu(menuItemExtractFromQuery, menuItemRemove)); }
/** * 컨텍스트 메뉴 추가. * * @Date 2015. 10. 14. * @param tableView * @param mode * Menus 클래스 참고 * @return * @User KYJ */ public static void addMenus(Control node, int mode) { ContextMenu contextMenu = new ContextMenu(); if (Menus.isAdd(mode)) { contextMenu.getItems().add(addMenuEvent(node)); } if (Menus.isDelete(mode)) { contextMenu.getItems().add(deleteMenuEvent(node)); } if (Menus.isUp(mode)) { contextMenu.getItems().add(upMenuEvent(node)); } if (Menus.isDown(mode)) { contextMenu.getItems().add(downMenuEvent(node)); } node.setContextMenu(contextMenu); }
@Override public void init() { MenuItem miReflesh = new MenuItem("Reflesh"); miReflesh.setOnAction(ex -> { getLineChartDayOfWeek().getData().clear(); getLineChartDayOfWeekCategory().getCategories().clear(); getBarChartDayOfMonth().getData().clear(); getBarChartDayOfMonthCategory().getCategories().clear(); load(); }); ContextMenu contextMenu = new ContextMenu(miReflesh); this.addEventFilter(MouseEvent.MOUSE_CLICKED, ev -> { contextMenu.hide(); if (ev.getButton() == MouseButton.SECONDARY) { contextMenu.show(FxUtil.getWindow(this), ev.getScreenX(), ev.getScreenY()); } }); }
protected void createContextMenu() { ContextMenu contextMenu = new ContextMenu(); txtLog.setContextMenu(contextMenu); MenuItem e = new MenuItem("EMRService Log Viewer"); e.setOnAction(ev -> { EMRServiceLogTableViewHelper helper = new EMRServiceLogTableViewHelper(this.txtLog.getText()); FxUtil.createStageAndShow(helper.getView(), stage -> { stage.initOwner(FxUtil.getWindow(composite.getParent())); stage.setTitle("EMRService Log Viewer"); stage.setWidth(1200d); stage.setHeight(800d); }); helper.start(); }); contextMenu.getItems().add(e); }
@Override protected Node createView0(OpenedFile file, String path) { HexArea editor = new HexArea(); editor.setContent(file.getContent(path)); ContextMenu newContextMenu = new ContextMenu(); MenuItem save = new MenuItem("Save"); save.setOnAction(e -> { save(editor).whenComplete((res, err) -> { if (err != null) { err.printStackTrace(); } else { file.putContent(path, res); } }); }); newContextMenu.getItems().add(save); editor.setContextMenu(newContextMenu); return editor; }
public void openOpenNewTabMenu() { if (root.getSelectionModel().getSelectedItem() != null) { Tab selectedFile = root.getSelectionModel().getSelectedItem(); ContextMenu contextMenu = new ContextMenu(); for (EditorView ev : editorController.getRegisteredEditors()) { MenuItem item = new MenuItem(ev.getDisplayName()); item.setOnAction(event -> { openNewEditor(selectedFile, ev); }); contextMenu.getItems().add(item); } contextMenu.setOnHidden(event -> { isMenuOpen = false; }); Point p = MouseInfo.getPointerInfo().getLocation(); contextMenu.show(root.getScene().getWindow(), p.x, p.y); } }
public void addContextMenu( Node node) { MenuItem menuItem; // create context menu ContextMenu contextMenu = new ContextMenu(); // add attractor menuItem = new MenuItem("Add Attractor"); menuItem.setOnAction(e -> addAttractor()); contextMenu.getItems().add( menuItem); // add repeller menuItem = new MenuItem("Add Repeller"); menuItem.setOnAction(e -> addRepeller()); contextMenu.getItems().add( menuItem); // context menu listener node.setOnMousePressed(event -> { if (event.isSecondaryButtonDown()) { contextMenu.show(node, event.getScreenX(), event.getScreenY()); } }); }
private void initializeUICanvasEditor(@NotNull ArmaDisplay display) { canvasControls.getTreeViewMain().setToDisplay(display); canvasControls.getTreeViewBackground().setToDisplay(display); uiCanvasEditor.setComponentMenuCreator(new ComponentContextMenuCreator() { @Override public @NotNull ContextMenu initialize(CanvasComponent component) { return new DefaultComponentContextMenu(((ArmaControlRenderer) component).getMyControl()); } }); uiCanvasEditor.getDoubleClickUpdateGroup().addListener((group, clickedControl) -> { if (clickedControl != null && clickedControl == uiCanvasEditor.getSelection().getFirst()) { DefaultComponentContextMenu.showControlPropertiesPopup((ArmaControl) clickedControl); } }); uiCanvasEditor.setCanvasContextMenu(new CanvasContextMenu()); setupEditorSelectionSync(); }
protected void reset() { tabPane.getTabs().clear(); eventList.getItems().clear(); for (int i = 0; i < TABS_NUM; i++) { Tab tab = new NamedTab("Tab " + i); tab.setTooltip(new Tooltip("Tab " + i)); ContextMenu menu = new ContextMenu(); for (int j = 0; j < 3; j++) { menu.getItems().add(new MenuItem("Tab " + i + " menu item " + j)); } tab.setContextMenu(menu); if (tab.getContextMenu() != menu) { error.setText("tab.setContextMenu() fails"); } tabPane.getTabs().add(tab); } tabPane.setSide(Side.TOP); error.setText(""); }
private void createScene(JFXPanel fxMainPanel) { redPane = new StackPane(); redPane.setPrefSize(100.0, 100.0); redPane.setStyle("-fx-background-color: red"); ContextMenu contextMenu = new ContextMenu(); MenuItem menuItem = new MenuItem("Test Menu Item"); contextMenu.getItems().add(menuItem); redPane.setOnContextMenuRequested(event -> { contextMenu.show(redPane, event.getScreenX(), event.getScreenY()); event.consume(); }); contextMenu.showingProperty().addListener(this::onchange); scene = new Scene(redPane); fxMainPanel.setScene(scene); robot.setAutoWaitForIdle(true); }
private void initContextMenu() { contextMenu = new ContextMenu(); contextMenu.setId(CONTEXT_MENU_ID); for(int i = 1; i <= 5; i++) { contextMenu.getItems().add(new MenuItem("item - " + i)); } contextMenu.setOnShown(new EventHandler<WindowEvent>() { public void handle(WindowEvent t) { TextField tfCounter = hm.get(Options.contextMenuOnShown.toString()); assertTrue(tfCounter != null); String text = tfCounter.getText(); if (text.equals("")) { tfCounter.setText("1"); } else { int val = Integer.parseInt(text); val++; tfCounter.setText(String.valueOf(val)); } } }); }
@Smoke @Test(timeout = 300000) public void radioSizingTest() throws Throwable { Wrap<? extends Menu> menu = menuBarAsParent.lookup(new MenuByText(MenuItemApp.RADIO_ID)).wrap(); Parent<MenuItem> menu_as_parent = menu.as(Parent.class, MenuItem.class); expand(menu, true); final Scene popup_scene = Root.ROOT.lookup(new LookupCriteria<Scene>() { public boolean check(Scene scene) { if (!(scene.getWindow() instanceof ContextMenu)) { return false; } return true; } }).get(); Double width = getWidth(popup_scene); Double height = getHeight(popup_scene); for (int i = 0; i < menu_as_parent.lookup().size(); i++) { Wrap<? extends MenuItem> item_wrap = menu_as_parent.lookup().wrap(i); item_wrap.mouse().move(); Double new_width = getWidth(popup_scene); Double new_height = getHeight(popup_scene); assertEquals(width, new_width); assertEquals(height, new_height); } }
private ContextMenu establishContextMenu () { ContextMenu context = new ContextMenu(); MenuItem turtleStatus = new MenuItem(TURTLE_STATUS + id); SeparatorMenuItem separator = new SeparatorMenuItem(); MenuItem visibility = new MenuItem(TOGGLE_VISIBILITY_PROMPT); visibility.setOnAction(e -> visibilityAction()); MenuItem shape = new MenuItem(CHANGE_SHAPE_PROMPT); shape.setOnAction(e -> shapeAction()); MenuItem color = new MenuItem(CHANGE_TURTLE_PEN_COLOR); color.setOnAction(e -> colorAction()); MenuItem stamp = new MenuItem(STAMP); stamp.setOnAction(e -> writeToInternalEditor(new StringBuilder(idsToCommands.getString((STAMP))))); context.getItems().addAll(turtleStatus, separator, visibility, color, shape, stamp); return context; }
@Override protected void updateItem(Project item, boolean empty) { super.updateItem(item, empty); if (empty || item == null) { setText(null); setGraphic(null); } else { this.item = Objects.requireNonNull(item); setText(item.getName()); ContextMenu contextMenu = new ContextMenu(); MenuItem menuDelete = new MenuItem(); menuDelete.setText("Delete"); menuDelete.setOnAction(this::deleteMenuAction); contextMenu.getItems().addAll(menuDelete); setContextMenu(contextMenu); } }
/** * Builds context menu for files. * * @return context menu */ private ContextMenu buildFileContextMenu() { ContextMenu menu = new ContextMenu(); MenuItem cut = new MenuItem("Cut"); MenuItem copy = new MenuItem("Copy"); MenuItem paste = new MenuItem("Paste"); MenuItem delete = new MenuItem("Delete"); menu.getItems().addAll(cut, copy, paste, delete); cut.setOnAction(event -> cut()); copy.setOnAction(event -> copy()); paste.setOnAction(event -> paste()); delete.setOnAction(event -> delete()); return menu; }
public static void getFileContextMenu(HBox fileIcon, String fileName, MouseEvent e, ClientObject client) { ContextMenu cm = new ContextMenu(); MenuItem sb1 = new MenuItem("Delete File"); MenuItem sb2 = new MenuItem("Download File"); sb2.setOnAction(event -> { DirectoryChooser directoryChooser = new DirectoryChooser(); directoryChooser.setTitle("Select download location"); File selectedDirectory = directoryChooser.showDialog(Maus.getPrimaryStage()); FileContextMenu.selectedDirectory = selectedDirectory.getAbsolutePath(); try { client.clientCommunicate("DOWNLOAD"); client.clientCommunicate(fileName); } catch (IOException e1) { Logger.log(Level.ERROR, e1.toString()); } }); cm.getItems().addAll(sb1, sb2); cm.show(fileIcon, e.getScreenX(), e.getScreenY()); }
@Override protected ContextMenu generateContextMenu(final Analyzer<?> analyzer) { final ContextMenu menu = new ContextMenu(); final MenuItem edit = new MenuItem("Edit"); edit.setOnAction(e -> editAnalyzer(analyzer)); final MenuItem save = new MenuItem("Save As Custom"); save.setOnAction(e -> saveAnalyzers(ReportSectionTab.this.analyzerListView.getSelectionModel().getSelectedItems())); final MenuItem delete = new MenuItem("Delete"); delete.setOnAction(e -> deleteAnalyzers(ReportSectionTab.this.analyzerListView.getSelectionModel().getSelectedItems())); menu.getItems().add(edit); menu.getItems().add(save); menu.getItems().add(delete); return menu; }
@Override protected ContextMenu generateContextMenu(final CustomAnalyzer<?> customAnalyzer) { final ContextMenu menu = new ContextMenu(); final MenuItem edit = new MenuItem("Edit"); edit.setOnAction(e -> editAnalyzer(customAnalyzer)); final MenuItem clone = new MenuItem("Clone"); clone.setOnAction(e -> cloneAnalyzer(customAnalyzer.getAnalyzer())); final MenuItem add = new MenuItem("Add To Report"); add.setOnAction(e -> addAnalyzers(AnalyzerPaneController.this.customAnalyzersListView.getSelectionModel().getSelectedItems().stream() .map(c -> c.getAnalyzer()).collect(Collectors.toList()))); final MenuItem delete = new MenuItem("Delete"); delete.setOnAction(e -> deleteAnalyzers(AnalyzerPaneController.this.customAnalyzersListView.getSelectionModel().getSelectedItems())); menu.getItems().add(edit); menu.getItems().add(add); menu.getItems().add(clone); menu.getItems().add(delete); return menu; }
public static <S, T> Callback<TableColumn<S, T>, TableCell<S, T>> forTableColumn(final ContextMenu contextMenu, final Callback<TableColumn<S, T>, TableCell<S, T>> cellFactory) { return column -> { TableCell<S, T> cell; if (cellFactory == null) { cell = new TableCell<S, T>(); cell.itemProperty().addListener((observable, oldValue, newValue) -> { cell.setText(newValue == null ? null : newValue.toString()); }); } else { cell = cellFactory.call(column); } cell.setContextMenu(contextMenu); return cell; }; }
/** * Make a Pane that contains a Context menu that can be displayed on-screen * * @param menuActions that can be performed * * @return Menu Pane */ private Pane makeMenuPane(MenuActions menuActions) { ContextMenu burgerMenu = new GlobalContextMenu(menuActions); Button menu = new Button(MENU_LABEL); menu.setFocusTraversable(false); menu.setContextMenu(burgerMenu); menu.setOnAction(e -> menu.getContextMenu().show(menu, Side.BOTTOM, 0, 10)); FlowPane toolBar = new FlowPane(10, 0, menu); toolBar.setMaxHeight(40); toolBar.setMaxWidth(40); // workaround to make it not confiscate the whole top of the screen toolBar.setPadding(new Insets(10)); toolBar.getStyleClass().add("overlayButtons"); return toolBar; }
private void addContextMenuToLabel(Label label) { MenuItem miBlack = new MenuItem("black"); MenuItem miRed = new MenuItem("red"); MenuItem miYellow = new MenuItem("yellow"); MenuItem miGreen = new MenuItem("green"); MenuItem miBlue = new MenuItem("blue"); MenuItem miOrange = new MenuItem("orange"); MenuItem miPurple = new MenuItem("purple"); MenuItem miPink = new MenuItem("pink"); MenuItem miGrey = new MenuItem("grey"); miBlack.setOnAction(event1 -> label.setStyle("-fx-text-fill: black; -fx-cursor: hand;")); miRed.setOnAction(event1 -> label.setStyle("-fx-text-fill: red; -fx-cursor: hand")); miYellow.setOnAction(event1 -> label.setStyle("-fx-text-fill: yellow; -fx-cursor: hand")); miGreen.setOnAction(event1 -> label.setStyle("-fx-text-fill: green; -fx-cursor: hand")); miBlue.setOnAction(event1 -> label.setStyle("-fx-text-fill: blue; -fx-cursor: hand")); miOrange.setOnAction(event1 -> label.setStyle("-fx-text-fill: orange; -fx-cursor: hand")); miPurple.setOnAction(event1 -> label.setStyle("-fx-text-fill: purple; -fx-cursor: hand")); miPink.setOnAction(event1 -> label.setStyle("-fx-text-fill: deeppink; -fx-cursor: hand")); miGrey.setOnAction(event1 -> label.setStyle("-fx-text-fill: grey; -fx-cursor: hand")); ContextMenu ctm = new ContextMenu(); ctm.getItems().addAll(miBlack, miRed, miYellow, miGreen, miBlue, miOrange, miPurple, miPink, miGrey); label.setContextMenu(ctm); }
private void setTableContextMenu() { tableTrace.setRowFactory(param -> { TableRow<TraceLineInfo> row = new TableRow<>(); MenuItem moreGeoIPInfo = new MenuItem(" Show GeoIP results from multiple sources"); moreGeoIPInfo.setOnAction(event9 -> Main.openInBrowser(GeoIPResolver.getSecondaryGeoIpPrefix() + row.getItem().ipAddressProperty().get())); Menu copyMenu = generateCopyMenu(row); ContextMenu rowMenu = new ContextMenu(moreGeoIPInfo, copyMenu); row.contextMenuProperty().bind(Bindings.when(Bindings.isNotNull(row.itemProperty())).then(rowMenu).otherwise((ContextMenu) null)); return row; }); }
private void setMapContextMenu() { imgView.setOnContextMenuRequested(event -> { MenuItem copyMap = new MenuItem(" Copy map image"); copyMap.setOnAction(mapEvent -> { Clipboard clipboard = Clipboard.getSystemClipboard(); ClipboardContent content = new ClipboardContent(); content.putImage(imgView.getImage()); clipboard.setContent(content); }); ContextMenu menu = new ContextMenu(copyMap); menu.show(imgView.getScene().getWindow(), event.getScreenX(), event.getScreenY()); }); }
public static ContextMenu createCMForStructureViewList(ListView<Actor> listView) { ContextMenu cm = new ContextMenu(); CustomMenuItem addActorMenuItem = GUIUtil.createTooltipedMenuItem("Add new", "Create new global Actor and add it to currently selected SisScene.\n\n" + aboutActor); Menu addExistingActorMenuItem = generateAddExistingActorMenu(false); addActorMenuItem.setOnAction((ActionEvent event) -> { addNewActor(); }); cm.getItems().addAll(addActorMenuItem); if (addExistingActorMenuItem.getItems().size() != 0) { cm.getItems().add(addExistingActorMenuItem); } cm.autoHideProperty().set(true); return cm; }