setar o foreground swing code example
Example: setar o foreground swing
package com.javacodegeeks.snippets.desktop;
import java.awt.Color;
import java.awt.FlowLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
public class SetForegroundColorInJLabel extends JFrame {
private static final long serialVersionUID = 1L;
public SetForegroundColorInJLabel() {
this.getContentPane().setLayout(new FlowLayout());
JLabel label = new JLabel("Java Code Geeks - Java Examples");
label.setForeground(Color.BLUE);
add(label);
}
private static void createAndShowGUI() {
JFrame frame = new SetForegroundColorInJLabel();
frame.pack();
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}