use of javafx.scene.control.MenuItem 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.MenuItem in project trex-stateless-gui by cisco-system-traffic-generator.
the class ChartContainer method handleContextMenuAction.
private void handleContextMenuAction(ActionEvent event) {
MenuItem source = (MenuItem) event.getSource();
chartType.set(source.getText());
chart.setActive(true);
}
use of javafx.scene.control.MenuItem in project on-track by michaelplazek.
the class TrackModelController method toggleSelectedFailures.
/**
* Toggle the failures.
* @param event pass event.
*/
public void toggleSelectedFailures(ActionEvent event) {
Button btn = (Button) event.getSource();
for (MenuItem item : failures.getItems()) {
if (CheckMenuItem.class.isInstance(item) && CheckMenuItem.class.cast(item).isSelected()) {
if (item.getId().equals(powerFailureSelect.getId())) {
if (btn.getId().equals(start.getId())) {
blocks[(int) blockNumber.getValue() - 1].setPowerStatus(true);
powerStatus.setFill(Color.GREEN);
} else if (btn.getId().equals(end.getId())) {
blocks[(int) blockNumber.getValue() - 1].setPowerStatus(false);
powerStatus.setFill(Color.WHITE);
}
} else if (item.getId().equals(railFailureSelect.getId())) {
if (btn.getId().equals(start.getId())) {
blocks[(int) blockNumber.getValue() - 1].setBrokenRailStatus(true);
railStatus.setFill(Color.GREEN);
} else if (btn.getId().equals(end.getId())) {
blocks[(int) blockNumber.getValue() - 1].setBrokenRailStatus(false);
railStatus.setFill(Color.WHITE);
}
} else if (item.getId().equals(trackFailureSelect.getId())) {
if (btn.getId().equals(start.getId())) {
blocks[(int) blockNumber.getValue() - 1].setTrackCircuitStatus(true);
circuitStatus.setFill(Color.GREEN);
} else if (btn.getId().equals(end.getId())) {
blocks[(int) blockNumber.getValue() - 1].setTrackCircuitStatus(false);
circuitStatus.setFill(Color.WHITE);
}
}
}
}
}
use of javafx.scene.control.MenuItem 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.MenuItem 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);
}
Aggregations