java复选框没被选择,在CodenameOne中,为什么没有选中复选框但显示为选中状态?...
我有一個奇怪的問題 - 不確定是否存在編碼錯誤或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?
與50位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的java复选框没被选择,在CodenameOne中,为什么没有选中复选框但显示为选中状态?...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php去字符串空格,php怎么去掉字符串
- 下一篇: java jaspersoft,Jasp