java复选框没被选择,在CodenameOne中,为什么没有选中复选框但显示为选中状态?...
我有一個(gè)奇怪的問題 - 不確定是否存在編碼錯(cuò)誤或CN1中的錯(cuò)誤 .
基本上我創(chuàng)建了一行CheckBox對(duì)象并將它們放在一個(gè)X-Scrollable的容器中 . 如果我單擊一個(gè)未選擇的項(xiàng)目并拖動(dòng),直到“彈性”效果將其拉回,它似乎被選中,但代碼不會(huì)將其記錄為選中 .
請(qǐng)注意,在控制臺(tái)輸出中,單詞“selected”在選擇字段時(shí)大寫,在取消選擇時(shí)小寫 . 焦點(diǎn)相同(我將焦點(diǎn)添加到輸出以確定setFocusable()是否按預(yù)期工作,因此焦點(diǎn)不應(yīng)歸咎于選擇錯(cuò)誤) .
這是Checkbox創(chuàng)建代碼:
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(我現(xiàn)在意識(shí)到它們不僅僅是CheckBoxes,因?yàn)槲以谕蟿?dòng)操作期間設(shè)置"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 "
這是我做的更多調(diào)試 .
第一個(gè)按鈕是按下,但未選中(錯(cuò)誤) .
第二個(gè)按鈕被正常選中而沒有顯示錯(cuò)誤 .
第三個(gè)按鈕很有趣,因?yàn)槲疫x擇它,然后拖動(dòng)并釋放它以使其被選中并按下!
所以問題變?yōu)?#xff1a; 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位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的java复选框没被选择,在CodenameOne中,为什么没有选中复选框但显示为选中状态?...的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php去字符串空格,php怎么去掉字符串
- 下一篇: 印象笔记怎么做思维导图