i haven't found a GRadioButton or something so i made mine myself, if you guys want it's here. Probably it's not the most efficient implementation, but as soon as i have seen, it works well.
package States.HUD.GUIAdaptations;
import com.jmex.bui.BToggleButton;
import com.jmex.bui.icon.BIcon;
/**
* GRadioButton is a class that extends BToggleButton that should work something
* like RadioButton from swing. Uses a GRadioGroup class to determine which
* buttos are from the same group. to find out which RadioButton is selected,
* ask for the GRadioGroup.getSelected();
* @author Rafael Guedes Martins.
*/
public class GRadioButton extends BToggleButton {
GRadioGroup radioGroup;
public GRadioButton(String _tiptext) {
super(_tiptext);
}
public GRadioButton(String _tiptext, GRadioGroup radioGroup) {
super(_tiptext);
setRadioGroup(radioGroup);
}
public GRadioButton(BIcon icon, String _action) {
super(icon, _action);
}
public GRadioButton(String _tiptext, String _action) {
super(_tiptext, _action);
}
public void setRadioGroup(GRadioGroup radioGroup) {
this.radioGroup = radioGroup;
radioGroup.add(this);
}
@Override
protected void fireAction(long when,
int modifiers) {
if (_selected) {
return;
}
if (radioGroup != null) {
radioGroup.disableOthers(this);
}
super.fireAction(when, modifiers);
}
}
package States.HUD.GUIAdaptations;
import java.util.Vector;
/**
* The GRadioGroup to support the GRadioButton.
* @author Rafael Guedes Martins
*/
public class GRadioGroup extends Vector<GRadioButton> {
GRadioButton selected;
protected void disableOthers(GRadioButton aThis) {
selected = aThis;
for (int c = 0; c < elementCount; c++) {
if (elementData[c] == null || elementData[c] == aThis) {
continue;
} else {
((GRadioButton)elementData[c]).setSelected(false);
}
}
}
public GRadioButton getSelected(){
return selected;
}
}