Example:
I want to make most of the Components have a certain background color and certain foreground color, and I want to change it if default Color seems off. Primary methods to achieve this are setBackgroundColor() and setForegroundColor().
Most plausible answer for me is:
public class DefaultComponent {
private static final BACKGROUND_COLOR = Color.GRAY;
private static final FOREGROUND_COLOR = Color.WHITE;
public static void setComponent(Component comp) {
comp.setBackground(backgroundColor);
comp.setForeground(foregroundColor);
}
}
Is this the correct approach? Also is there a special name for such a construct, such as in Factory?