// demonstrate how to add things import javax.swing.*; import java.awt.*; public class AddStuff2 { public static void main(String[] args) { new MyGUI(); } } class MyGUI { private JFrame f; private Container c; public MyGUI() { f = new JFrame("AddStuff2"); f.setSize(500,500); c = f.getContentPane(); c.setLayout(new FlowLayout(FlowLayout.LEFT) ); for (int b = 1; b < 9;b++) c.add(new JButton("Button "+b)); f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }