/* TestFlow.java CIS 160 David Klick 2011-09-24 Demonstration of FlowLayout layout manager */ import java.awt.Container; import java.awt.FlowLayout; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.SwingUtilities; public class TestFlow extends JFrame { public TestFlow() { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } private void createAndShowGUI() { setSize(200,200); setDefaultCloseOperation(EXIT_ON_CLOSE); Container c = getContentPane(); c.setLayout(new FlowLayout()); c.add(new JButton("Button 1")); c.add(new JButton("Button 2")); c.add(new JButton("Button 3")); c.add(new JButton("Button 4")); c.add(new JButton("Button 5")); setVisible(true); } public static void main(String[] args) { TestFlow app = new TestFlow(); } }