Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

text area question

 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I make an error message like this, generated by a member of a package



show up in a text area of a different member of the same package?

Thanks!
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What part of that are you having a problem with? Catching the exception? Turning it into text? Writing it to a text area?

And by the way I don't understand what these "packages" are which you mention.
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are 2 members of the same package --



One member -- Scheduler.java -- generates the error message. The problem is that I want to write the text of that message into a text area called statusTextArea that is located in a second member of the combocontrol package called ComboControlView.java. If I just write it this way within Scheduler.java



I get the expected error message "cannot find symbol: variable statusTextArea". How do I amend the statement to show the text area's proper location in ComboControlView.java?
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or maybe someone could tell me what topic I'm looking for and I could google it. I've been looking but I don't think I'm describing it correctly in search terms.
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay. Your question appears to be the very common one "How do I allow one class to access members of another class?"

That's asked quite regularly around here. I have tried to answer it in the past but my answer always seems to turn into a long spiel about object-oriented design; unfortunately the question is usually asked by somebody who doesn't have a really strong grasp of what an object is and why you might want to design one, so it's wasted time all around.

So I'm giving up on that strategy. Sorry for the non-answer. Perhaps somebody else would like to give it a try.
 
Maneesh Godbole
Saloon Keeper
Posts: 11183
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Access instance variable of class A from B. Hmmm.

One way of doing it. Refer code comments



Another way of doing it. Notice the getInstance() method in ComboControlView. This way you dont need to pass and store the references via the constructor. More loosely coupled than the code above
 
Scott A Burch
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a great answer. It's very clear. Thank you so much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic