标签: java javafx-8
我对Java FX菜单按钮有这个非常恼人的问题。我有一个动态(在运行时)将项目添加到菜单按钮菜单的应用程序。菜单按钮位于屏幕底部,因此菜单向上打开。菜单项添加在菜单列表的底部。问题有时这会导致菜单按钮在菜单按钮上被点击时最终会自动修正,但由于菜单中有动态项目,因此会重复发生。有没有办法强制重新计算菜单位置,所以当它打开时它不会覆盖菜单按钮?
The diagram on the left is what I would like to have happen when the menu is opened. The diagram on the right is what actually happens when the menu is shown after adding a menu item (the whole menu is drawn on top of the menu button)