我在 Java 的组合框中添加了复选框。但是当我打开下拉菜单并选中一个复选框时,下拉菜单会关闭。所以要选中每个复选框,我必须每次都打开它。 有什么办法可以让下拉列表保持打开状态,直到我不在外面单击,这样我才能一次选择任意数量的复选框。 请帮忙!!
最佳答案
I have added checkboxes inside combo box in Java. But when I open drop down menu and check one check box, the drop down menu closes. So to select each check box I have to open it every time. Is there any way so that I can keep the drop down list opened till the time I dont click outside so that I can select any number of check boxes at one time only.
不,没有,这是Swing API中实现的(BasicXxx)Popup的默认属性,Java1.4_xxx系列Bug的解决方法
no_way,只能使用肮脏的 hack,使用可能是 Java 版本敏感的,或者需要鼠标左键作为加速器
不要那样做,另一种方法(也是可能的正确方法)是使用 JWindow/未修饰的 JDialog,但需要覆盖在 Windows 3 中丢失的 ESC 键和焦点(正如您在良好的 Java JCalandars/中看到的那样) JDatePickers),
关于java - JComboBox 中的 JCheckBoxes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22300323/