Example usage for javax.swing JMenuBar setForeground

List of usage examples for javax.swing JMenuBar setForeground

Introduction

In this page you can find the example usage for javax.swing JMenuBar setForeground.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.")
public void setForeground(Color fg) 

Source Link

Document

Sets the foreground color of this component.

Usage

From source file:Main.java

/**
 * change background and foreground color for menu bar
 * @param aMenuBar menu bar// w w  w. ja va  2s  .  c o m
 * @param aBackgroundColor background color
 * @param aForegroundColor foreground color
 */
public final static void ChangeColor(JMenuBar aMenuBar, Color aBackgroundColor, Color aForegroundColor) {
    if (aBackgroundColor != null) {
        aMenuBar.setBackground(aBackgroundColor);
    }
    if (aForegroundColor != null) {
        aMenuBar.setForeground(aForegroundColor);
    }
    JMenu menu = null;
    for (int count = 0; count < aMenuBar.getMenuCount(); count++) {
        menu = aMenuBar.getMenu(count);
        ChangeColor(menu, aBackgroundColor, aForegroundColor);
    }
}