use of javafx.scene.control.ContextMenu in project Gargoyle by callakrsos.
the class MacroSqlComposite method post.
@FxPostInitialize
public void post() {
MenuItem menuAddItem = new MenuItem("Add");
menuAddItem.setAccelerator(new KeyCodeCombination(KeyCode.INSERT, KeyCharacterCombination.CONTROL_DOWN));
menuAddItem.setOnAction(e -> {
addOnAction();
});
MenuItem menuDeleteItem = new MenuItem("Delete");
menuDeleteItem.setAccelerator(new KeyCodeCombination(KeyCode.DELETE, KeyCharacterCombination.CONTROL_DOWN));
menuDeleteItem.setOnAction(e -> {
addOnAction();
});
tvFavorite.setContextMenu(new ContextMenu(menuAddItem, menuDeleteItem));
borContent.setCenter(new MacroControl(connectionSupplier, initText));
MacroFavorTreeItemCreator macroFavorTreeItem = new MacroFavorTreeItemCreator(connectionSupplier);
MacroItemVO f = new MacroItemVO();
tvFavorite.setRoot(macroFavorTreeItem.createRoot(f));
tvFavorite.setShowRoot(false);
}
use of javafx.scene.control.ContextMenu in project blue by kunstmusik.
the class BSBEditPane method setupPopupMenus.
private void setupPopupMenus(BSBObjectEntry[] bsbObjectEntries) {
popupMenu = new ContextMenu();
EventHandler<ActionEvent> al = e -> {
MenuItem m = (MenuItem) e.getSource();
Class<? extends BSBObject> clazz = (Class<? extends BSBObject>) m.getUserData();
try {
BSBObject bsbObj = clazz.newInstance();
bsbObj.setX(addX);
bsbObj.setY(addY);
currentBSBGroup.addBSBObject(bsbObj);
} catch (InstantiationException | IllegalAccessException ex) {
Exceptions.printStackTrace(ex);
}
};
for (BSBObjectEntry entry : bsbObjectEntries) {
MenuItem m = new MenuItem("Add " + entry.label);
m.setUserData(entry.bsbObjectClass);
m.setOnAction(al);
popupMenu.getItems().add(m);
}
MenuItem paste = new MenuItem("Paste");
paste.setOnAction(ae -> paste(addX, addY));
paste.disableProperty().bind(Bindings.createBooleanBinding(() -> selection.copyBufferProperty().size() == 0, selection.copyBufferProperty()));
popupMenu.getItems().addAll(new SeparatorMenuItem(), paste);
nonEditPopupMenu = new ContextMenu();
MenuItem randomize = new MenuItem("Randomize");
randomize.setOnAction(ae -> {
if (bsbInterface != null) {
bsbInterface.getRootGroup().randomize();
}
});
nonEditPopupMenu.getItems().add(randomize);
}
use of javafx.scene.control.ContextMenu in project kanonizo by kanonizo.
the class KanonizoFrame method addLibListeners.
private void addLibListeners() {
ContextMenu menu = new ContextMenu();
MenuItem addLib = new MenuItem();
addLib.textProperty().set("Add Library");
addLib.setOnAction((ActionEvent ev) -> {
FileChooser fc = new FileChooser();
fc.setInitialDirectory(fw.getRootFolder());
fc.setSelectedExtensionFilter(new ExtensionFilter("Only jar files!", "jar"));
List<File> jar = fc.showOpenMultipleDialog(KanonizoFxApplication.stage);
if (jar != null) {
for (File j : jar) {
fw.addLibrary(j);
}
}
});
menu.getItems().add(addLib);
libs.addEventHandler(MouseEvent.MOUSE_CLICKED, ev -> {
if (ev.getButton().equals(MouseButton.SECONDARY)) {
menu.show(libs, ev.getScreenX(), ev.getScreenY());
} else if (menu.isShowing()) {
menu.hide();
}
});
GuiUtils.setDefaultListName(libs);
}
use of javafx.scene.control.ContextMenu in project uPMT by coco35700.
the class MomentContextMenu method init.
public void init(Stage stage) {
HBox root = new HBox();
root.setPadding(new Insets(5));
root.setSpacing(5);
// Create ContextMenu
contextMenu = new ContextMenu();
MenuItem item1 = new MenuItem("Menu Item 1");
item1.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// clique sur item1
}
});
MenuItem item2 = new MenuItem("Menu Item 2");
item2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
// clique sur item2
}
});
Button item3 = new Button("Bt");
// Add MenuItem to ContextMenu
// contextMenu.getItems().addAll(item1, item2, item3);
}
use of javafx.scene.control.ContextMenu in project jfreechart-fx by jfree.
the class ChartViewer method createContextMenu.
/**
* Creates the context menu.
*
* @return The context menu.
*/
private ContextMenu createContextMenu() {
final ContextMenu menu = new ContextMenu();
menu.setAutoHide(true);
Menu export = new Menu("Export As");
MenuItem pngItem = new MenuItem("PNG...");
pngItem.setOnAction(e -> handleExportToPNG());
export.getItems().add(pngItem);
MenuItem jpegItem = new MenuItem("JPEG...");
jpegItem.setOnAction(e -> handleExportToJPEG());
export.getItems().add(jpegItem);
if (ExportUtils.isOrsonPDFAvailable()) {
MenuItem pdfItem = new MenuItem("PDF...");
pdfItem.setOnAction(e -> handleExportToPDF());
export.getItems().add(pdfItem);
}
if (ExportUtils.isJFreeSVGAvailable()) {
MenuItem svgItem = new MenuItem("SVG...");
svgItem.setOnAction(e -> handleExportToSVG());
export.getItems().add(svgItem);
}
menu.getItems().add(export);
return menu;
}
Aggregations