title: Change value from another form java
body: <p>I have a main form (RandomSend) and another form called (_user)
  in the randomsend form I declare a public <strong>static</strong> variable:</p>
  
  <pre><code> public class RandomSend extends javax.swing.JFrame {
   ......
  public static String userGender; // this variable I want to change from another form (_user)
  ....
  }
  </code></pre>
  
  <p>and in the RandomSend class I declared _user instance that try to change <strong>userGender</strong> value</p>
  
  <pre><code> _user setGender = new _user();
    setGender.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
    setGender.setAlwaysOnTop(true);
    setGender.setVisible(true);
  </code></pre>
  
  <p>In the _user form (class) I trying to change <strong>userGender</strong> vale:</p>
  
  <pre><code>public class _user extends javax.swing.JFrame {......
       ....
       RandomSend.userGender="male";
       ....}
  </code></pre>
  
  <p>when I check the value from within <strong>_user</strong> , the value of RandomSend.userGender is "male"</p>
  
  <p>but from my main form the value is null...</p>
  
  <hr>
  
  <p><strong>new new</strong></p>
  
  <p>My attempt According to answer number 1
  public class RandomSend extends javax.swing.JFrame {</p>
  
  <pre><code>/**
   *
   */
  
  private static String userGender;
   .....
  .....
  // show dialogbox to select gender...
   _user setGender = new _user();
    setGender.setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE);
    setGender.setAlwaysOnTop(true);
    setGender.setVisible(true);
  
  ....
  ....
  
  // setter
  public static void setUserGender(String gender)
  {
      if(gender.toLowerCase().equals("female") ||gender.toLowerCase().equals("male"))
      userGender = gender;
      else userGender= "Unknown!!";
  }
  
  //getter
  public static String getUserGender()
  {
          return userGender;
   }
  </code></pre>
  
  <p>and in the other class (frame) :</p>
  
  <pre><code>public class _user extends javax.swing.JFrame {
  ....
  ....
  
  RandomSend.setUserGender("male");
  ..
  ..
  ..
  }
  </code></pre>
  
  <p>but the Randomsend.userGender doesn't change!</p>