1   import java.awt.*;
2   import javax.swing.*;
3   
4   public class NullLayoutTest extends JApplet {
5       private JButton button1 = new JButton("ボタン1");
6       private JButton button2 = new JButton("ボタン2");
7       private JButton button3 = new JButton("ボタン3");
8       private JButton button4 = new JButton("ボタン4");
9       
10      public void init() {
11          setSize(200, 200);
12          
13          Container c = getContentPane();
14          c.setLayout(null);
15          c.setBackground(Color.white);
16          
17          button1.setBounds(10, 10, 100, 30);
18          button2.setBounds(10, 20, 100, 30);
19          button3.setBounds(100, 100, 80, 80);
20  
21          c.add(button1);
22          c.add(button2);
23          c.add(button3);
24          c.add(button4);
25      }
26  }
27