// Example 3.7: A colored panel containing a red text// message in a blue rectangle, centered in the panelimport javax.swing.*;import java.awt.*;public class ColorPanel extends JPanel{      public ColorPanel(Color backColor){      setBackground(backColor);   }   public void paintComponent(Graphics g){      super.paintComponent(g);      int x = getWidth() / 2 - 60;      int y = getHeight() / 2;      g.setColor(Color.blue);      g.drawRect(x, y, 120, 20);      g.setColor(Color.red);      g.drawString("Hello world!", x + 10, y + 15);   }}