This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JavaFX and the fly likes access GUI member directly? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "access GUI member directly?" Watch "access GUI member directly?" New topic
Author

access GUI member directly?

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
hi guys

i have a GUI that has the usual suspects in it a ComboBox and Treeview and Listview.. (javaFX)

my question is should these members be public or should i keep them private and use a public method to return and add values to these members?? from other classes and Threads and methods....

hope that makes sense

many thanks for your advice...

arrh wrong section sorry bout that....
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Having the variable private is general part of OOPS programming and I don't think there is anything different here.

If you want other classes to be notified when the selection is changed, the correct solution would be to attach them as listeners (say to the valueProperty of the combo box).


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
thanks for the reply...

i wasn't sure how best to access these members i will leave them as they are then good idea on the listener i will add one of them in....
 
Don't get me started about those stupid light bulbs.
 
subject: access GUI member directly?
 
Similar Threads
Sharpen your pencil, chapter numbers and statics
Basic Object Oriented design question
NX:Question about seperate GUI and Client
static modifiers
Chained Exceptions