// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import javax.swing.*;
import java.awt.*;

public class ShowCircles {
   public static void main(String[] args) {
      JFrame frame = new JFrame("Circles");
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      JLabel helloLabel = new JLabel("Test");
      helloLabel.setOpaque(true);
      helloLabel.setBackground(Color.white);
      helloLabel.setForeground(Color.black);
      JPanel westPanel = new JPanel();
      westPanel.setLayout(new GridLayout(3, 1));
      westPanel.add(new MyCircle(Color.red));
      westPanel.add(new MyCircle(Color.red));
      westPanel.add(new MyCircle(Color.red));
      JPanel eastPanel = new JPanel();
      eastPanel.setLayout(new GridLayout(3, 1));
      eastPanel.add(new MyCircle(Color.blue));
      eastPanel.add(new MyCircle(Color.blue));
      eastPanel.add(new MyCircle(Color.blue));
      frame.getContentPane().add(westPanel, BorderLayout.WEST);
      frame.getContentPane().add(helloLabel, BorderLayout.CENTER);
      frame.getContentPane().add(eastPanel, BorderLayout.EAST);
      frame.pack();
      frame.setVisible(true);
   }
}

class MyCircle extends JPanel {
   private Color c;
   public MyCircle(Color c) {
      this.c = c;
      this.setPreferredSize(new Dimension(100, 100));
   }
   public void paintComponent(Graphics g) {
      g.setColor(c);
      g.fillOval(0, 0, 100, 100);
   }
}
