When you right click on a TextField there are Undo, Redo, Cut, Copy, Paste, Delete, and Select All options.
I want to add a "Register" MenuItem to that list from my controller class, but do not know how.
Here is what I got so far:
This overwrites the existing menu items:
ContextMenu contextMenu = new ContextMenu();
MenuItem register = new MenuItem("Register");
contextMenu.getItems().add(register);
charName.setContextMenu(contextMenu);
Both of these return null:
charName.getContextMenu()
charName.contextMenuProperty().getValue()
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…