File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "access GUI member directly?" Watch "access GUI member directly?" New topic

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

Joined: Oct 16, 2003
Posts: 1101

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).

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....
Consider Paul's rocket mass heater.
subject: access GUI member directly?
It's not a secret anymore!