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

             JPanel buttonPane = new JPanel();

             getContentPane().add(buttonPane, BorderLayout.SOUTH);

             buttonPane.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));

             JButton okButton = new JButton("OK");

             okButton.addActionListener(new ActionListener() {

                   public void actionPerformed(ActionEvent e) {

                          setVisible(false);

                   }

             });

             okButton.setActionCommand("OK");

             buttonPane.add(okButton);

             getRootPane().setDefaultButton(okButton);

             JPanel panel = new JPanel();

             contentPanel.add(panel);

             BufferedImage image = null;

             try

                   String path = new File(".").getCanonicalPath() + File.separator;

                   if (plane.getModelName().equals("Su-35")) {

                          path += "Su35.png";

                   }

                   if (plane.getModelName().equals("Airbus")) {

                          path += "Airbus.png";    

                   }

                   if (plane.getModelName().equals("Boeing-747")) {

                          path += "Boeing.png";    

                   }

            image = ImageIO.read(new File(path));

            } catch (IOException ex) {

                  ex.printStackTrace();

            }

             panel.setLayout(new GridLayout(0, 2, 0, 0));

             JLabel icon = new JLabel(new ImageIcon(image));

             panel.add(icon);

             JPanel panel_1 = new JPanel();

             panel.add(panel_1);

             JLabel lblNewLabel = new JLabel("Model");

             JLabel lblWeight = new JLabel("Weight");

             JLabel lblHeight = new JLabel("Height");

             JLabel lblWingarea = new JLabel("Wingarea");

             modelNameField = new JTextField();

             modelNameField.setEditable(false);

             modelNameField.setColumns(10);

             weightField = new JTextField();

             weightField.setEditable(false);

             weightField.setColumns(10);

             heightField = new JTextField();

             heightField.setEditable(false);

             heightField.setColumns(10);

             wingareaField = new JTextField();

             wingareaField.setEditable(false);

             wingareaField.setColumns(10);

             GroupLayout gl_panel_1 = new GroupLayout(panel_1);

             gl_panel_1.setHorizontalGroup(

                  gl_panel_1.createParallelGroup(Alignment.LEADING)

                         .addGroup(gl_panel_1.createSequentialGroup()

                                .addContainerGap(18, Short.MAX_VALUE)

                                .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING, false)

                                      .addGroup(gl_panel_1.createSequentialGroup()

                                             .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)

                                                   .addComponent(lblNewLabel)

                                                   .addComponent(lblWeight)

                                                   .addComponent(lblHeight))

                                             .addGap(66)