java bods - giving all classes access to swing components This is a long shot - A question that has been bugging me for ages. How can you give all (or most) of the classes in a java access to swing components in a particular class. So say I have gui.java with all the swing code in it, and I want other classes to be able to output to a textarea, or disable menu items, in that class - how would I go about that? without passing all the components round in the constructors? hope this makes sense - anyone who can help gets a free gold star.
so if I have class1 { int foo; } class2 extends class1 { // foo is inherited } class3 extends class2 { } ^^^ am I right in thinking foo will also be available in class 3?
my only problem with that is i dont want to have to inherit the first class 4 classes down the line if you like just to access one swing component : / i can just see it getting messy. will using an interface work?
i dont code in java but what ive learned from OO in vb.net is that all your members/fields etc etc are always inherited and accessible no matter how much you inherit unless you specifically declare them as overrideable, overrides or whatever. that probably doesnt help.