我有一个奇怪的问题 - 不确定是否存在编码错误或CN1中的错误 .
基本上我创建了一行CheckBox对象并将它们放在一个X-Scrollable的容器中 . 如果我单击一个未选择的项目并拖动,直到“弹性”效果将其拉回,它似乎被选中,但代码不会将其记录为选中 .
请注意,在控制台输出中,单词“selected”在选择字段时大写,在取消选择时小写 . 焦点相同(我将焦点添加到输出以确定setFocusable()是否按预期工作,因此焦点不应归咎于选择错误) .
这是Checkbox创建代码:
cb = new CheckBox(getCacheableImageMaxHeight(mod.getIconFile(),moduleImageHeight));
cb.setName(mod.getModuleID());
cb.setToggle(true);
cb.setUIID("ModuleButton");
cb.setFocusable(false);
cb.setScrollVisible(false);
cb.setTextPosition(Component.BOTTOM);
cb.setCloudDestinationProperty(cb.getName());
//actionlistener added for debugging only
final CheckBox cbFinal = cb;
final String modName = mod.getDisplayName();
cb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
System.out.println(modName+", "+(cbFinal.isSelected()?"SELECTED":"selected") + ", " + (cbFinal.hasFocus()?"FOCUS":"focus"));
}
});
c.addComponent(cb);
UPDATE: I've realized there are two "states" at war here: toggleButtons(我现在意识到它们不仅仅是CheckBoxes,因为我在拖动操作期间设置"setToggle(true)) are getting stuck in the "按下" state as they are dragged and released with the "被按下" and "被选中" states have the same appearance so that means my users think they have selected something when it's just stuck being "
这是我做的更多调试 .
第一个按钮是按下,但未选中(错误) .
第二个按钮被正常选中而没有显示错误 .
第三个按钮很有趣,因为我选择它,然后拖动并释放它以使其被选中并按下!
所以问题变为: Is there an open bug for this situation already (Pressed state gets stuck on after button is released) and if so, is there a fix coming or a workaround for now?