/* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author STUDENT */ // Fig. 13.27: PanelDemo.java // Using a JPanel to help lay out components. import java.awt.*; import java.awt.event.*; import javax.swing.*; public class PanelLayoutDemo extends JFrame { private JPanel buttonPanel; private JButton buttons[]; //set up GUI public PanelLayoutDemo() { super("Panel Demo"); //get content pane Container container=getContentPane(); //create button array buttons=new JButton[5]; //set up panel and set its layout buttonPanel= new JPanel(); buttonPanel.setLayout(new GridLayout(1,buttons.length)); //create and add buttons for (int count = 0; count