Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Change jframe background color (Java)

Source code below will show you how to change jframe background color. You can try new color base on RGB value by change value at Color b=new Color(R_value,G_value,B_value). You can use "Color picker" above to get new R,G and B value.

*********************************************
COMPLETE SOURCE CODE FOR : ChangeJFrameBackgroundColour.java
*********************************************
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.Color;

public class ChangeJFrameBackgroundColour
{
public static void main(String[]args)
{
 JFrame a=new JFrame("CHANGE BACKGROUND COLOUR");

 //Now we will try change it's value
 Color b=new Color(120,255,0);

 JPanel c=new JPanel();
 c.setBackground(b);

 a.add(c);
 a.setSize(600,200);
 a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 a.setVisible(true);

 //I hope you enjoy
 //Bye
}
}


*********************************************
JUST COMPILE AND EXECUTE IT
*********************************************