how to get background color of jlabel in java code example
Example 1: set color of text for jlabel
JLabel title = new JLabel("Want a Raise?", JLabel.CENTER);
title.setForeground(Color.white);
Example 2: how to set background color in jframe in java
package Exaple;
import java.awt.Color;
import javax.swing.JFrame;
public class Window {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
frame.setTitle("Expaple");
frame.setBackground(Color.BLUE);
}
}