Re: problem with radiobutton
It's hard for me to tell what's wrong based on the snippets of code posted. You might want to try to simplify your problem greatly by creating a GUI program that is small, compilable and runnable by us, and that reproduces your problem.
If it were my program though, I wouldn't even use a boolean variable but instead would use myRadioButton.isSelected() for my boolean at the time that it is needed.
Re: problem with radiobutton
you say like this??
private void jRadioButton1ActionPerformed(java.awt.event.Action Event evt) {
// TODO add your handling code here:
if(!selected ){
RMI = jRadioButton1.isSelected();
selected = true;
}
namePlayer.setText("teste"+RMI);
}
Re: problem with radiobutton
No. Wherever you're using your boolean variable RMI (which is mis-capitalized by the way), you would use the radiobutton's state itself:
Code:
UDPRecebe udp = new UDPRecebe(info, jRadioButton1.isSelected());
I rarely give JRadioButton's ActionListeners since usually I don't want to know the state of the button when it has been pressed but rather when some other event takes place, such as if the user presses some "Accept" button.
Re: problem with radiobutton
give'me false, but i resolve the problem with a check box..
like this
boolean checked = jCheckBox1.isSelected();
if(checked){
UDPRecebe udp = new UDPRecebe(info, true);
Thread t1 = new Thread(udp);
t1.start();
}else {
UDPRecebe udp = new UDPRecebe(info, false);
Thread t1 = new Thread(udp);
t1.start();
}