    01: import java.awt.*;
    02: import java.awt.geom.*;
    03: import java.awt.event.*;
    04: import javax.swing.*;
    05:
    06: /**
    07:    A program that allows users to edit a scene composed
    08:    of items.
    09: */
    10: public class SceneEditor
    11: {
    12:    public static void main(String[] args)
    13:    {
    14:       JFrame frame = new JFrame();
    15:       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    16:
    17:       Container contentPane = frame.getContentPane();
    18:       final ScenePanel panel = new ScenePanel();
    19:
    20:       JButton houseButton = new JButton("House");
    21:       houseButton.addActionListener(new
    22:          ActionListener()
    23:          {
    24:             public void actionPerformed(ActionEvent event)
    25:             {
    26:                panel.add(new HouseShape(20, 20, 50));
    27:             }
    28:          });
    29:
    30:       JButton carButton = new JButton("Car");
    31:       carButton.addActionListener(new
    32:          ActionListener()
    33:          {
    34:             public void actionPerformed(ActionEvent event)
    35:             {
    36:                panel.add(new CarShape(20, 20, 50));
    37:             }
    38:          });
    39:
    40:       JButton removeButton = new JButton("Remove");
    41:       removeButton.addActionListener(new
    42:          ActionListener()
    43:          {
    44:             public void actionPerformed(ActionEvent event)
    45:             {
    46:                panel.removeSelected();
    47:             }
    48:          });
    49:
    50:       JPanel buttons = new JPanel();
    51:       buttons.add(houseButton);
    52:       buttons.add(carButton);
    53:       buttons.add(removeButton);
    54:
    55:       contentPane.add(panel, BorderLayout.CENTER);
    56:       contentPane.add(buttons, BorderLayout.NORTH);
    57:
    58:       frame.setSize(300, 300);
    59:       frame.show();
    60:    }
    61: }
    62:
    63: