Is it possible for me to set the text on JToggle button to "ON" if it is selected and if not, as "OFF"? I'm trying with this code:
if(togbut.isSelected()){
togbut.setText("ON");
}
else if(!togbut.isSelected()){
togbut.setText("OFF");
}
But it doesn't work. I use NetBeans 7.3.