按键采用弹出窗口下方显示 [英] Button with popup showed below

查看:143
本文介绍了按键采用弹出窗口下方显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想JavaFX中创建特定的组件。按钮,onClick事件后显示poupup。

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

Scnenario:

Scnenario:


  1. 我们点击按钮

  1. We click button

弹出窗口显示下面的按钮(就像图片)

Popup Shows below button (like on the picture)

推荐答案

在回答这个之后,我意识到这是的的JavaFX 2自定义弹出面板,这在一些问题的答案多一点的上下文信息。

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            
);

下面是一个完整的,可执行样品

这篇关于按键采用弹出窗口下方显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆