dúvida com radiobutton

bem eu queria que ao seleccionar uma radioButton uma variável global toma-se o valor de true…

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                              
// TODO add your handling code here:
  RMI = jRadioButton1.isSelected();
  nomeJogador.setText("valor"+RMI);
 
    
}                                             
 public synchronized void run() {
               
                UDPRecebe udp = new UDPRecebe(info, RMI);
                Thread t1 = new Thread(udp);
                t1.start();

o problema é que quando chega a outra classe o valor devolvido é false apesar de o valor na textbox aparecer true :S

Alguem pode me ajudar???

Cria o boolean com static!

tambem n funciona :\

Kd a parte do código onde seta true?

linha 3, kuando a radio button esta selecionado o valor da variavel RMI passa a true.

Cara você vai precisar setar em uma variavel da classe… exemplo:


private static boolean selecionado = false;


private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                                 
// TODO add your handling code here:   
  if(!selecionado ){
      RMI = jRadioButton1.isSelected();   
      nomeJogador.setText("valor"+RMI);   
      selecionado = true;
  }
       
}                                               
public synchronized void run() {   
                 
                UDPRecebe udp = new UDPRecebe(info, RMI);   
                Thread t1 = new Thread(udp);   
                t1.start();  

Acredito que seja este o seu problema… de qualquer forma você tera que setar true, em uma variavel static da sua classe…
Assim se outra referencia clicar no Radio estará TRUE.

continua a chegar false a outra classe :\

Coloca toda sua classe ae?

[code]public class GUI extends javax.swing.JFrame {

Cara testa assim…

public class GUI extends javax.swing.JFrame {   
   informationRequest info;   
   private static boolean RMI = false;   

ctn a n funcionar :\

public class UDPRecebe extends Thread{   
  
    static final int PORTO = 3110;   
    static final int MAX_TAMANHO_MSG = 1024;   
    private static HashMap<String , String[]> info = new HashMap<>();   
    ArrayList<String[]> nickList = new ArrayList<>();   
   // public String[] nickList;   
    informationRequest inf;   
    volatile servGetInfoReq sgir;   
    volatile int index;   
    public String ip;   
    private String nome, estado;   
    boolean RMI;   
    String s1;   
    public UDPRecebe(informationRequest inf, boolean RMI){ 
// AKI vc não estava setando as variáveis  
        this.RMI = RMI;
        this.informationRequest = informationRequest;
    } 

isto são uns excertos da classe GUI k contêm o boolean RMI

public class GUI extends javax.swing.JFrame {
   informationRequest info;
   private static boolean RMI = false;
private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                              

     if(RMI==false)
            RMI=true;
        else
            RMI=false;
     nomeJogador.setText("ooo"+RMI);
}   
      public synchronized void run(informationRequest info) {
     this.info = info;
    
                UDPRecebe udp = new UDPRecebe(info, RMI);
                Thread t1 = new Thread(udp);
                t1.start();
    }  
A outra classe
    boolean RMI;
    String s1;
    private String rsp;
    private String adversario;
    public UDPRecebe(informationRequest inf, boolean RMI){
        this.inf = inf;
        this.RMI = RMI;
        
     
    }

chega sempre false :S