public boolean keyPressed(int key) { int ga = UICanvas.getInstance().getGameAction(key); boolean keepSelection = false; if (ga == Canvas.FIRE && this.selectedIndex >= 0 // && this.chechedIndex != selectedIndex ) { if (this.chechedIndex >= 0) { UILabel ulbOld = (UILabel) this.layoutItems[this.chechedIndex]; ulbOld.img = UICanvas.getUIImage("/icons/radio_unchecked.png"); ulbOld.setDirty(true); } this.chechedIndex = this.selectedIndex; UILabel ulb = (UILabel) this.layoutItems[this.chechedIndex]; ulb.img = UICanvas.getUIImage("/icons/radio_checked.png"); ulb.setSelected(true); this.setDirty(true); this.askRepaint(); keepSelection = true; } keepSelection |= super.keyPressed(key); // we must save the last selectedIndex // when loosing focus if (keepSelection == false) { if (selectedIndex >= 0) { UILabel ulbOld = (UILabel) this.layoutItems[this.selectedIndex]; ulbOld.setSelected(false); ulbOld.setDirty(true); this.setDirty(true); this.askRepaint(); } this.selectedIndex = this.chechedIndex; } return keepSelection; }