Изучение графических средств создания пользовательского интерфейса платформы Java, страница 2

                          .addComponent(list, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 242, Short.MAX_VALUE)

             );

             contentPane.setLayout(gl_contentPane);

      }

}

public class CreatePlaneDialog extends JDialog {

      private final JPanel contentPanel = new JPanel();

      private Plane plane = null;

      private boolean planeIsCreated = false;

      private final static PlaneFactory FACTORY = new PlaneFactory();

      public CreatePlaneDialog(JFrame parent) {

                   super(parent);

                   setResizable(false);

                   setModalityType(ModalityType.DOCUMENT_MODAL);

             setTitle("Create plane");

             setBounds(100, 100, 331, 70);

             getContentPane().setLayout(new BorderLayout());

             contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

             getContentPane().add(contentPanel, BorderLayout.CENTER);

             contentPanel.setLayout(new GridLayout(1, 3));

             {

                   JButton createBoeingButton = new JButton("Boeing 747");

                   createBoeingButton.addActionListener(new ActionListener() {

                          public void actionPerformed(ActionEvent e) {

                                plane = FACTORY.getBoeing();

                                planeIsCreated = true;

                                setVisible(false);

                          }

                   });

                   contentPanel.add(createBoeingButton);

             }

             {

                   JButton createSuButton = new JButton("Su 35");

                   createSuButton.addActionListener(new ActionListener() {

                          public void actionPerformed(ActionEvent e) {

                                plane = FACTORY.getSu();

                                planeIsCreated = true;

                                setVisible(false);

                          }

                   });

                   contentPanel.add(createSuButton);

             }

             {

                   JButton createAirbusButton = new JButton("Airbus");

                   createAirbusButton.addActionListener(new ActionListener() {

                          public void actionPerformed(ActionEvent e) {

                                plane = FACTORY.getAirbus();

                                planeIsCreated = true;

                                setVisible(false);

                          }

                   });

                   contentPanel.add(createAirbusButton);

             }

      }

      Plane getPlane() {

             return plane;

      }

      boolean isPlaneCreated() {

             return planeIsCreated;

      }

}

public class PlaneView extends JDialog {

      private final JPanel contentPanel = new JPanel();

      private JTextField modelNameField;

      private JTextField weightField;

      private JTextField heightField;

      private JTextField wingareaField;

      public PlaneView(Plane plane, JFrame parent) {

             super(parent);

             setModalityType(ModalityType.DOCUMENT_MODAL);

             setBounds(100, 100, 513, 313);

             getContentPane().setLayout(new BorderLayout());

             getContentPane().add(contentPanel, BorderLayout.CENTER);

             contentPanel.setLayout(new GridLayout(1, 2, 0, 0));