2 Replies Latest reply: Nov 23, 2012 11:12 AM by 922723 RSS

    How to send data to a controller class and put as text into TextField?

    922723
      Hi guys. Can you tell me, how I can send data to a contoller class and use that data to put as text into TextField?
        • 1. Re: How to send data to a controller class and put as text into TextField?
          dscarminiabielefeld
          Hey,
          what kind of data do you exactly want to put as text? String, Integer, [...] ?
          If you have 2 classes for example, and you declare a variable called variableA in class1, and you want to use it in class2, cause this class manages your textfield, you probably can do this:

          Class 1:
          public class HeyYou
          {
          private double variableA = 5
          
          public double getVariableA()
          {
               return variableA;
          }
          }
          class2:
          private TextField myTextField;
          private HeyYou    HeyYouInstance;
          HeyYouInstance = new HeyYou();
          private double     TheDoubleWeGet;
          HeyYouInstance   = HeyYou.getInstance();
          TheDoubleWeGet = HeyYouInstance.getVariableA();
          myTextField.setText(Double.toString(TheDoubleWeGet));
          Your TextField now sets the text to 5.
          Hope this helped and was actually what you were looking for.. :-)
          Greetings,
          biele

          Edited by: dscarminiabielefeld on 22-Nov-2012 23:05

          Edited by: dscarminiabielefeld on 22-Nov-2012 23:06
          • 2. Re: How to send data to a controller class and put as text into TextField?
            922723
            Ok friend, I'm going to try it to have if it works.