Button with popup showed below [closed]

核能气质少年 提交于 2019-12-02 14:34:41

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/15553448/button-with-popup-showed-below

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!