0

I want to create specific component in JavaFX. Button which show poupup after onClick event.

Scnenario:

  1. We click button

  2. Popup Shows below button (like on the picture)

enter image description here

plancys
  • 3,833
  • 2
  • 19
  • 26

1 Answers1

6

After answering this, I realized it was a duplicate of JavaFX 2 custom popup pane, which has a bit more context info in some of the answers.

Use a MenuButton and in a menuItem attached to the MenuButton, set a graphic for the content you want to display in your popup.

final MenuItem wizPopup = new MenuItem();
wizPopup.setGraphic(wizBox);

final MenuButton popupButton = new MenuButton("frobozz");
popupButton.getItems().setAll(
  wizPopup            
);

Here is a complete, executable sample.

wizup

Community
  • 1
  • 1
jewelsea
  • 150,031
  • 14
  • 366
  • 406