import javax.swing.*; public class Demo { public static void main(String [] args) { JFrame frame = new JFrame("Layout manager demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // We're going to show the different kinds of layouts each // in its own tab. We use a JTabbedPane object, which will act // as a single component within our frame, and it will consist // of various panels each in its own tab. JTabbedPane pane = new JTabbedPane(); pane.addTab("Intro", new IntroPanel()); pane.addTab("Flow layout", new FlowPanel()); pane.addTab("Border layout", new BorderPanel()); pane.addTab("Grid layout", new GridPanel()); pane.addTab("Box layout", new BoxPanel()); frame.getContentPane().add(pane); frame.pack(); frame.show(); } }