Home:ALL Converter>Display pop up window on context menu item click Java fx

Display pop up window on context menu item click Java fx

Ask Time:2015-07-29T14:42:10         Author:hermy67

Json Formatter

I am very new to Java and Java FX and I have been struggling a lot in creating a pop up window on context menu click. My requirement is

  1. Tree view -- done
  2. Display context menu with few options New, Open on each tree node -- done
  3. Now when I click new in context menu, I need to display a pop up window that shows a text of and a button. On clicking the button, text entered in text box should be created as child in the tree. -- struggling on this

It's just like how we right click on netbeans and see new button. Someone please help.

Thank you so much!

Author:hermy67,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/31693047/display-pop-up-window-on-context-menu-item-click-java-fx
Kaito :

public class MyPopUp extends Stage {\n public MyPopUp () {\n super();\n this.setTitle(\"Pop\");\n this.setResizable(false);\n // The important part\n this.initModality(Modality.APPLICATION_MODAL);\n\n BorderPane borderPaneOptionPane = new BorderPane();\n borderPaneOptionPane.setCenter(new TextArea()); // For example\n\n Button closeButton = new Button(\"Close\");\n closeButton.setOnAction(event -> {\n this.hide();\n });\n\n borderPaneOptionPane.setPadding(new Insets(5));\n\n Scene s = new Scene(borderPaneOptionPane);\n this.setScene(s);\n}}\n\n\nthen simply use .show method to set it visible.\n\nHope I could help you.\n\nGreetings Kaito",
2015-07-29T11:11:50
yy