Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

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

import javax.accessibility.AccessibleContext;

public class Main {
    private static void setForeground0(AccessibleContext ac, Color fg) {
        ac.getAccessibleComponent().setForeground(fg);
        for (int i = 0; i < ac.getAccessibleChildrenCount(); i++) {
            setForeground0(ac.getAccessibleChild(i).getAccessibleContext(), fg);
        }
    }

    /**
     * Recursively changes the foreground of a component and all its children.
     *
     * @param c - The Root Component
     * @param fg - The Foreground Colour
     */
    public static void setForeground(Component c, Color fg) {
        setForeground0(c.getAccessibleContext(), fg);
    }
}