After quite a bit of tinkering around, I’ve finally gotten my 2D scene graph/controls to satisfactory point in regards to functionality. Now I’m trying to come up with a way to theme everything in a consistent way. For the moment I have to set individual properties on each control such as background color, foreground color, borders, etc. Ideally I’d like to set a basic theme and have that style applied to my controls when they’re created similar to what Swing does with the L&F/componentui framework.
The controls have been developed to work with Slick2D and all of them inherit from a base control class that contains a majority of the appearance based variables. I’ve thought about using something like the builder or factory pattern, but I really don’t want to have to write a new builder/factory for each type of control. I’ve also considered making a “themer” class that I can pass a component to after it’s created, but that seems a bit cumbersome as well.
Has anybody had experience with this issue who can offer some suggestions for the best way to approach this? While it’s not critical, it would certainly save me a lot of time when putting together an interface as well as cut down on the LOC I have to look through when developing other parts of my project. Any help would be greatly appreciated.