import javax.swing.JPanel; import java.awt.Color; JPanel panel = new JPanel(); panel.setBackground(Color.green); //To know all the colors, check this link: //https://docs.oracle.com/javase/7/docs/api/java/awt/Color.html