**********************************************************************
COMPLETE SOURCE CODE FOR : SetJPanelBackgroundColor.java
**********************************************************************
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Color;
public class SetJPanelBackgroundColor
{
public static void main(String[]args)
{
//Create panel using JPanel
JPanel panel=new JPanel();
//Create JFrame with title ( Set JPanel background color )
JFrame frame=new JFrame("Set JPanel background color");
//Set color base on RGB
//You can get RGB value for your color at "Color picker" at above
//R=255
//G=0
//B=0
Color color=new Color(255,0,0);
//Set JPanel background color to color that you choose
panel.setBackground(color);
//Add JPanel into JFrame
frame.add(panel);
//Set default close operation for JFrame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Set JFrame size
frame.setSize(500,300);
//Make JFrame visible
frame.setVisible(true);
}
}
**********************************************************************
JUST COMPILE AND EXECUTE IT
**********************************************************************