public jTextField ?
Ok simple question! I have a swing jFrame in a netbeans java application project and a jTextField inside of it. Is there any possible way of retrieving the text from the textField using another class? Obviously i cannot do that because the textField is declared private in swing awt but i was wondering if there is any way around it.
Thanks in advance!
Add a public getter method that can get the contents and return it.
Are these Java SE classes you are talking about? The lowercase j makes me wonder.
@Norms - maybe its the component name like jTextField1, jTextField2 and so on.
It is the name being assign by netbeans at design time but it can be change.
@OP - you also have to create instance of that class then call the getter method
public class ClassA
public String getTextFieldText()
public class ClassB
ClassA aClassA = new ClassA();
private void textFromOtherClass()
Should be changed.
Originally Posted by mine0926