Container cp = getContentPane(); // Make sure it has a FlowLayout layoutmanager. cp.setLayout(new FlowLayout()); // now add Components to "cp"... cp.add(new JLabel("Wonderful?")); cp.add(new JButton("Yes!")); pack();
new JFrameFlowLayout().setVisible(true);