How do I open the ColorPicker Custom Colors window by clicking on an individual menu item?
I am trying to open a window ColorPicker
Custom Colors
by clicking on one of the menu items from my popup ContextMenu
.
ContextMenu contextMenu = new ContextMenu();
MenuItem menuItemBgColor = new MenuItem("Background Color");
menuItemBgColor.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent ae) {
// Open ColorPicker "Custom Colors" window.
}
});
contextMenu.getItems().add(menuItemBgColor);
However, I don't know how I can achieve this. I tried using CustomMenuItem
:
CustomMenuItem cmi = new CustomMenuItem(new ColorPicker());
... but the added color picker was "un-clickable".
What I want to achieve is to open a window Custom Colors
by clicking on a given standard MenuItem
:
+3
source to share
No one has answered this question yet
Check out similar questions: