i’m building the gui for my app mostly using swing components. i know that at somepoint i am going to want to tweak the coloring of the interface. so instead of hardcoding the colors into each component, i’ve created a simple object to wrap public fields of type Color. however, this means that i have to create this aforementioned ColorPalette object to access it from within my gui components.
in action, it might look like this:
ColorPalette cp = new ColorPalette();
... (somewhere later in the component's code) ...
this.setBackground( cp.bkgd );
obviously this will save time later if i want to tweak colors, or even give the user control over some things. however, it seems kind of clunky. i had a suspicion that some java guru might have a slicker way to approach global setttings.
if i make the ColorPalette a final class, will that mean i don’t have to instantiate it each time?
any ideas approaches to this kind of a typical problem would be great.
thx.