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

                                             .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING)

                                                   .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)

                                                   .addComponent(weightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)

                                                   .addComponent(modelNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))

                                      .addGroup(gl_panel_1.createSequentialGroup()

                                             .addComponent(lblWingarea)

                                             .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

                                             .addComponent(wingareaField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))

                                .addGap(48))

             );

             gl_panel_1.setVerticalGroup(

                   gl_panel_1.createParallelGroup(Alignment.LEADING)

                         .addGroup(gl_panel_1.createSequentialGroup()

                                .addGap(30)

                                .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)

                                       .addComponent(lblNewLabel)

                                       .addComponent(modelNameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))

                                .addGap(18)

                                .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)

                                       .addComponent(lblWeight)

                                       .addComponent(weightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))

                                .addGap(18, 18, Short.MAX_VALUE)

                                .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)

                                       .addComponent(lblHeight)

                                       .addComponent(heightField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))

                                .addGap(18)

                                .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)

                                       .addComponent(lblWingarea)

                                       .addComponent(wingareaField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))

                                .addGap(89))

             );

             panel_1.setLayout(gl_panel_1);

             modelNameField.setText(plane.getModelName());

             weightField.setText(String.valueOf(plane.getWeight()));

             heightField.setText(String.valueOf(plane.getHeight()));

            wingareaField.setText(String.valueOf(plane.getWingArea()));

             repaint();

      }

}

Скриншоты демонстрации программы

Вывод

В ходе выполнения данной лабораторной работы я изучила базовые возможности библиотеку Swing. Для построения форм в лабораторной работе использовались элементы: JList, JButton, JLabel, JTextField.