import javax.swing.*; import java.awt.*; class Program extends JFrame { JPanel panel1; JPanel panel2; Program() { panel1 = new JPanel(); panel2 = new JPanel(); panel1.setSize(200, 200); panel1.setLocation(50, 50); panel1.setBackground(Color.blue); panel2.setSize(200, 200); panel2.setLocation(50, 280); panel2.setBackground(Color.red); this.setLayout(null); this.add(panel1); this.add(panel2); this.setSize(800, 600); this.setLocationRelativeTo(null); this.setVisible(true); } public static void main(String args[]) { new Program(); } }