I have a java program thats works with an LDAP server. Basically, it gets some values, and outputs them to the dos console window. Problem is, I want them to go to the JTextArea on the GUI.
I have one method that creates the GUI, one that acts as actionPerformed (when I push the connect button) and then methods for getting the info I need. What I need to do is in the methods that get the info, I need to write to the text area. But because it is private I cant do it.
Anyone know how I can write to a private JTextArea from another method?
That is one way. There are some better ways albeit a bit more involved as it has to do with observable patterns and what not. You could also just make the text area public. Or you could have a public call back method that writes to the private text area.
Originally posted by Alan Jackson: Thanks very much. What would the someClass bit you mentioned refer to?
Well, since you said that you can't access the JTextArea object because it is private, I assumed your method for accessing LDAP was in a different class than your JTextArea. someClass is that other class. If this is not the case, I'd be cuirous as to why you think you can't access a private member from the same class.