我想创建获取单选按钮并在其他单选按钮被标记时标记的方法。这是我漂亮的 gui 示例菜单:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<nifty>
<useControls filename="nifty-default-controls.xml"/>
<useStyles filename="nifty-default-styles.xml"/>
<screen id="ustawieniaWyswietlania" controller="PakietyPodstawowe.Kontroler.KontrolerUstawieńWyświetlania">
<layer id="GLayer0" childLayout="center">
<control id="r1" name="radioButtonGroup"/>
<panel id="GPanel0" childLayout="absolute" width="100%" x="210" y="257" style="nifty-panel-simple" height="100%">
<control name="radioButton" id="GRadioButton0" group="r1" x="193" y="236"/>
<control name="radioButton" id="GRadioButton1" group="r1" x="327" y="244"/>
</panel>
</layer>
</screen>
</nifty>
我的方法:
@NiftyEventSubscriber(pattern="GRadioButton.*")
public void setSelected(final String id, final RadioButtonStateChangedEvent event) {
IO.drukujL(event.getRadioButton().getElement().getId());
Element element = screen.findElementByName("GRadioButton1");
// element.setMarkted(); this method I can't find
}
也许这个问题很简单,但我不知道如何在标记 GRadioButton0 时自动标记 GRadioButton1。