import java.awt.*;
import javax.swing.*;
import java.awt.color.*;
public class ColorPanel extends JPanel{
public ColorPanel(Color backColor)
{
setBackground(backColor);
}
public void paintComponent(Graphics g)
{
super.paintComponent(g);
g.setColor(Color.blue);
g.drawRect(10, 5, 120, 20);
g.setColor(Color.red);
g.drawString("Hello", 20, 20);
}
}