Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.awt.Color;
import java.awt.Component;
import java.awt.Container;

public class Main {
    public static void setColor_r(Component c, Color bg, Color fg) {
        if (bg != null) {
            c.setBackground(bg);
        }
        if (fg != null) {
            c.setForeground(fg);
        }
        if (c instanceof Container) {
            Component[] comps = ((Container) c).getComponents();
            if (comps.length > 0) {
                for (Component comp : comps) {
                    setColor_r(comp, bg, fg);
                }
            }
        }
    }
}