title: Getting the value of TextField from one class to another with button
body: <p>I'm working on getting the value of a textfield from another class using Vaadin.</p>
  
  <p>my solution is something like this.</p>
  
  <pre><code>public class MyTextField{
  
      String str;
  
      public MyTextField(){
          TextField text = new TextField();
          str = text.getValue().toString();
      }
  
      public String getStr(){
          return str;
      }    
  }
  
  public class MyButton{    
      public MyButton(){
          Button button = new Button("UPDATE");
          button.addListener(new Button.ClickListener(){
              @Override
          public void buttonClick(ClickEvent event) {
                  MyTextField text = new MyTextField();
                  System.out.println(text.getStr());   
              }
          });
      }    
  }
  </code></pre>
  
  <p>the problem is, I always get null result. any help is highly appreciated. Thank you.</p>