2022-09-16 10:59:24 +04:00
|
|
|
|
/*
|
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
|
|
|
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
|
|
|
|
*/
|
|
|
|
|
package AirBomberPackage;
|
2022-10-16 16:42:31 +04:00
|
|
|
|
import java.awt.*;
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
import java.util.Random;
|
2022-09-16 10:59:24 +04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @author Андрей
|
|
|
|
|
*/
|
2022-10-31 19:31:33 +04:00
|
|
|
|
public class JFrameAirBomber extends javax.swing.JDialog {
|
2022-09-16 10:59:24 +04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates new form JFrameAirBomber
|
|
|
|
|
*/
|
2022-10-31 19:31:33 +04:00
|
|
|
|
public JFrameAirBomber(JFrame parent) {
|
|
|
|
|
super(parent, "Бомбардировщик", true);
|
2022-09-16 10:59:24 +04:00
|
|
|
|
initComponents();
|
|
|
|
|
}
|
2022-10-16 16:42:31 +04:00
|
|
|
|
|
2022-11-13 17:26:04 +04:00
|
|
|
|
public JFrameAirBomber(JFrame parent, DrawingObjectAirBomber airBomber) {
|
|
|
|
|
super(parent, "Бомбардировщик", true);
|
|
|
|
|
initComponents();
|
|
|
|
|
_airBomber = airBomber.getAirBomber();
|
|
|
|
|
SetData();
|
|
|
|
|
Draw();
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private DrawingAirBomber _airBomber;
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private EnginesType enginesType = EnginesType.RECTANGLE;
|
2022-10-31 19:31:33 +04:00
|
|
|
|
private DrawingAirBomber _airBomberResult;
|
2022-09-16 10:59:24 +04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This method is called from within the constructor to initialize the form.
|
|
|
|
|
* WARNING: Do NOT modify this code. The content of this method is always
|
|
|
|
|
* regenerated by the Form Editor.
|
|
|
|
|
*/
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
|
|
|
|
private void initComponents() {
|
|
|
|
|
|
2022-10-16 16:42:31 +04:00
|
|
|
|
createAirBomberButton = new javax.swing.JButton();
|
|
|
|
|
leftButton = new javax.swing.JButton();
|
|
|
|
|
downButton = new javax.swing.JButton();
|
|
|
|
|
rightButton = new javax.swing.JButton();
|
|
|
|
|
upButton = new javax.swing.JButton();
|
|
|
|
|
statusLabel = new javax.swing.JLabel();
|
|
|
|
|
airBomberCanvas = new AirBomberPackage.CanvasMy();
|
|
|
|
|
jLabelEngines = new javax.swing.JLabel();
|
|
|
|
|
jComboBoxEngines = new javax.swing.JComboBox<>();
|
2022-10-30 11:38:06 +04:00
|
|
|
|
ModifyButton = new javax.swing.JButton();
|
|
|
|
|
jLabelEngines1 = new javax.swing.JLabel();
|
|
|
|
|
jComboBoxEnginesType = new javax.swing.JComboBox<>();
|
2022-10-31 19:31:33 +04:00
|
|
|
|
buttonSelect = new javax.swing.JButton();
|
2022-10-16 16:42:31 +04:00
|
|
|
|
|
2022-10-31 19:31:33 +04:00
|
|
|
|
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
2022-10-16 16:42:31 +04:00
|
|
|
|
setTitle("Бомбардировщик");
|
|
|
|
|
setFont(new java.awt.Font("Arial", 0, 10)); // NOI18N
|
|
|
|
|
setSize(new java.awt.Dimension(700, 400));
|
|
|
|
|
|
|
|
|
|
createAirBomberButton.setText("Создать");
|
|
|
|
|
createAirBomberButton.setName("createAirBomberButton"); // NOI18N
|
|
|
|
|
createAirBomberButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
createAirBomberButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
leftButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/AirBomberPackage/arrowLeft.png"))); // NOI18N
|
|
|
|
|
leftButton.setMargin(new java.awt.Insets(0, 0, 0, 0));
|
|
|
|
|
leftButton.setMaximumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
leftButton.setMinimumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
leftButton.setName("buttonLeft"); // NOI18N
|
|
|
|
|
leftButton.setPreferredSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
leftButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
moveButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
downButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/AirBomberPackage/arrowDown.png"))); // NOI18N
|
|
|
|
|
downButton.setMaximumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
downButton.setMinimumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
downButton.setName("buttonDown"); // NOI18N
|
|
|
|
|
downButton.setPreferredSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
downButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
moveButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
rightButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/AirBomberPackage/arrowRight.png"))); // NOI18N
|
|
|
|
|
rightButton.setMaximumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
rightButton.setMinimumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
rightButton.setName("buttonRight"); // NOI18N
|
|
|
|
|
rightButton.setPreferredSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
rightButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
moveButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
upButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/AirBomberPackage/arrowUp.png"))); // NOI18N
|
|
|
|
|
upButton.setMaximumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
upButton.setMinimumSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
upButton.setName("buttonUp"); // NOI18N
|
|
|
|
|
upButton.setPreferredSize(new java.awt.Dimension(30, 30));
|
|
|
|
|
upButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
moveButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
statusLabel.setText("Скорость: Вес: Цвет: Двигатели:");
|
|
|
|
|
statusLabel.setMinimumSize(new java.awt.Dimension(0, 0));
|
|
|
|
|
|
|
|
|
|
airBomberCanvas.addComponentListener(new java.awt.event.ComponentAdapter() {
|
|
|
|
|
public void componentResized(java.awt.event.ComponentEvent evt) {
|
|
|
|
|
airBomberCanvasComponentResized(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jLabelEngines.setText("Количество двигателей: ");
|
|
|
|
|
|
|
|
|
|
jComboBoxEngines.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Два", "Четыре", "Шесть" }));
|
2022-09-16 10:59:24 +04:00
|
|
|
|
|
2022-10-30 11:38:06 +04:00
|
|
|
|
ModifyButton.setText("Модификация");
|
|
|
|
|
ModifyButton.setToolTipText("");
|
|
|
|
|
ModifyButton.setName("modifyButton"); // NOI18N
|
|
|
|
|
ModifyButton.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
ModifyButtonActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
jLabelEngines1.setText("Тип двигателей: ");
|
|
|
|
|
|
|
|
|
|
jComboBoxEnginesType.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Квадратный", "Треугольный", "Круглый" }));
|
|
|
|
|
jComboBoxEnginesType.addItemListener(new java.awt.event.ItemListener() {
|
|
|
|
|
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
|
|
|
jComboBoxEnginesTypeItemStateChanged(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2022-10-31 19:31:33 +04:00
|
|
|
|
buttonSelect.setText("Выбрать");
|
|
|
|
|
buttonSelect.addActionListener(new java.awt.event.ActionListener() {
|
|
|
|
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
|
|
|
buttonSelectActionPerformed(evt);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2022-09-16 10:59:24 +04:00
|
|
|
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
|
|
|
getContentPane().setLayout(layout);
|
|
|
|
|
layout.setHorizontalGroup(
|
|
|
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
2022-10-16 16:42:31 +04:00
|
|
|
|
.addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
.addContainerGap()
|
|
|
|
|
.addComponent(jLabelEngines)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addComponent(jComboBoxEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addComponent(jLabelEngines1)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addComponent(jComboBoxEnginesType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
.addComponent(createAirBomberButton)
|
|
|
|
|
.addGap(18, 18, 18)
|
2022-10-31 19:31:33 +04:00
|
|
|
|
.addComponent(ModifyButton)
|
|
|
|
|
.addGap(18, 18, 18)
|
|
|
|
|
.addComponent(buttonSelect)))
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 157, Short.MAX_VALUE)
|
2022-10-16 16:42:31 +04:00
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
|
|
|
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addGroup(layout.createSequentialGroup()
|
|
|
|
|
.addComponent(leftButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addComponent(downButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addComponent(rightButton, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addGap(17, 17, 17))
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
|
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
.addContainerGap())
|
2022-09-16 10:59:24 +04:00
|
|
|
|
);
|
|
|
|
|
layout.setVerticalGroup(
|
|
|
|
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
2022-10-16 16:42:31 +04:00
|
|
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
|
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
|
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
|
|
.addComponent(jLabelEngines, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addComponent(jComboBoxEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addComponent(jLabelEngines1)
|
|
|
|
|
.addComponent(jComboBoxEnginesType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
2022-10-16 16:42:31 +04:00
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
2022-10-31 19:31:33 +04:00
|
|
|
|
.addComponent(createAirBomberButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
|
|
|
.addComponent(buttonSelect, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
|
2022-10-30 11:38:06 +04:00
|
|
|
|
.addComponent(ModifyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
2022-10-16 16:42:31 +04:00
|
|
|
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
|
|
|
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
|
|
|
.addComponent(leftButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addComponent(downButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
|
|
|
.addComponent(rightButton, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
|
|
|
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
|
|
|
.addComponent(statusLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
|
2022-09-16 10:59:24 +04:00
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
pack();
|
|
|
|
|
}// </editor-fold>//GEN-END:initComponents
|
|
|
|
|
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private void createAirBomberButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createAirBomberButtonActionPerformed
|
|
|
|
|
Random rnd = new Random();
|
2022-10-31 19:31:33 +04:00
|
|
|
|
Color chosenColor = JColorChooser.showDialog(this, "Вибирете цвет", Color.BLACK);
|
|
|
|
|
_airBomber = new DrawingAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000), chosenColor, (jComboBoxEngines.getSelectedIndex() + 1) * 2, enginesType);
|
|
|
|
|
SetData();
|
2022-10-16 16:42:31 +04:00
|
|
|
|
Draw();
|
|
|
|
|
}//GEN-LAST:event_createAirBomberButtonActionPerformed
|
|
|
|
|
|
|
|
|
|
private void moveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveButtonActionPerformed
|
|
|
|
|
if (_airBomber == null) return;
|
|
|
|
|
String name = ((JButton) evt.getSource()).getName();
|
|
|
|
|
switch (name)
|
|
|
|
|
{
|
|
|
|
|
case "buttonUp":
|
|
|
|
|
_airBomber.MoveTransport(Direction.UP);
|
|
|
|
|
break;
|
|
|
|
|
case "buttonDown":
|
|
|
|
|
_airBomber.MoveTransport(Direction.DOWN);
|
|
|
|
|
break;
|
|
|
|
|
case "buttonLeft":
|
|
|
|
|
_airBomber.MoveTransport(Direction.LEFT);
|
|
|
|
|
break;
|
|
|
|
|
case "buttonRight":
|
|
|
|
|
_airBomber.MoveTransport(Direction.RIGHT);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
Draw();
|
|
|
|
|
}//GEN-LAST:event_moveButtonActionPerformed
|
|
|
|
|
|
|
|
|
|
private void airBomberCanvasComponentResized(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_airBomberCanvasComponentResized
|
|
|
|
|
if (_airBomber == null) return;
|
|
|
|
|
_airBomber.ChangeBorders(airBomberCanvas.getWidth(), airBomberCanvas.getHeight());
|
|
|
|
|
}//GEN-LAST:event_airBomberCanvasComponentResized
|
|
|
|
|
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private void ModifyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModifyButtonActionPerformed
|
|
|
|
|
Random rnd = new Random();
|
2022-10-31 19:31:33 +04:00
|
|
|
|
Color chosenColor = JColorChooser.showDialog(this, "Вибирете цвет", Color.BLACK);
|
|
|
|
|
Color chosenDopColor = JColorChooser.showDialog(this, "Вибирете цвет", Color.BLACK);
|
2022-10-30 11:38:06 +04:00
|
|
|
|
_airBomber = new DrawingHeavyAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
2022-10-31 19:31:33 +04:00
|
|
|
|
chosenColor,
|
2022-10-30 11:38:06 +04:00
|
|
|
|
(jComboBoxEngines.getSelectedIndex() + 1) * 2,
|
|
|
|
|
enginesType,
|
2022-10-31 19:31:33 +04:00
|
|
|
|
chosenDopColor,
|
2022-10-30 11:38:06 +04:00
|
|
|
|
rnd.nextBoolean(), rnd.nextBoolean(), rnd.nextBoolean());
|
|
|
|
|
SetData();
|
|
|
|
|
Draw();
|
|
|
|
|
}//GEN-LAST:event_ModifyButtonActionPerformed
|
|
|
|
|
|
|
|
|
|
private void jComboBoxEnginesTypeItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxEnginesTypeItemStateChanged
|
|
|
|
|
switch (jComboBoxEnginesType.getSelectedIndex())
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
enginesType = EnginesType.RECTANGLE;
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
enginesType = EnginesType.TRIANGLE;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
enginesType = EnginesType.OVAL;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}//GEN-LAST:event_jComboBoxEnginesTypeItemStateChanged
|
|
|
|
|
|
2022-10-31 19:31:33 +04:00
|
|
|
|
private void buttonSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSelectActionPerformed
|
|
|
|
|
_airBomberResult = _airBomber;
|
|
|
|
|
dispose();
|
|
|
|
|
}//GEN-LAST:event_buttonSelectActionPerformed
|
|
|
|
|
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private void SetData()
|
|
|
|
|
{
|
|
|
|
|
Random rnd = new Random();
|
|
|
|
|
_airBomber.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100), airBomberCanvas.getWidth(), airBomberCanvas.getHeight());
|
|
|
|
|
statusLabel.setText("Скорость: " + _airBomber.getAirBomber().getSpeed() + " Вес: " + (int) _airBomber.getAirBomber().getWeight() + " Цвет: " + _airBomber.getAirBomber().getBodyColor() + " Двигатели: " + _airBomber.drawingEngines.getNumberOfEngines());
|
|
|
|
|
airBomberCanvas.setAirBomber(_airBomber);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private void Draw(){
|
|
|
|
|
airBomberCanvas.repaint();
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-31 19:31:33 +04:00
|
|
|
|
public DrawingAirBomber run(){
|
|
|
|
|
setVisible(true);
|
|
|
|
|
return _airBomberResult;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-16 10:59:24 +04:00
|
|
|
|
/**
|
|
|
|
|
* @param args the command line arguments
|
|
|
|
|
*/
|
|
|
|
|
public static void main(String args[]) {
|
|
|
|
|
/* Set the Nimbus look and feel */
|
|
|
|
|
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
|
|
|
|
|
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
|
|
|
|
|
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
|
|
|
|
|
*/
|
|
|
|
|
try {
|
|
|
|
|
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
|
|
|
|
|
if ("Nimbus".equals(info.getName())) {
|
|
|
|
|
javax.swing.UIManager.setLookAndFeel(info.getClassName());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (ClassNotFoundException ex) {
|
|
|
|
|
java.util.logging.Logger.getLogger(JFrameAirBomber.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
|
} catch (InstantiationException ex) {
|
|
|
|
|
java.util.logging.Logger.getLogger(JFrameAirBomber.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
|
} catch (IllegalAccessException ex) {
|
|
|
|
|
java.util.logging.Logger.getLogger(JFrameAirBomber.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
|
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
|
|
|
java.util.logging.Logger.getLogger(JFrameAirBomber.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
|
|
|
}
|
|
|
|
|
//</editor-fold>
|
|
|
|
|
|
|
|
|
|
/* Create and display the form */
|
|
|
|
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
|
|
|
|
public void run() {
|
2022-11-13 17:26:04 +04:00
|
|
|
|
new JFrameMapWithSetAirBombers().setVisible(true);
|
2022-09-16 10:59:24 +04:00
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private javax.swing.JButton ModifyButton;
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private AirBomberPackage.CanvasMy airBomberCanvas;
|
2022-10-31 19:31:33 +04:00
|
|
|
|
private javax.swing.JButton buttonSelect;
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private javax.swing.JButton createAirBomberButton;
|
|
|
|
|
private javax.swing.JButton downButton;
|
|
|
|
|
private javax.swing.JComboBox<String> jComboBoxEngines;
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private javax.swing.JComboBox<String> jComboBoxEnginesType;
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private javax.swing.JLabel jLabelEngines;
|
2022-10-30 11:38:06 +04:00
|
|
|
|
private javax.swing.JLabel jLabelEngines1;
|
2022-10-16 16:42:31 +04:00
|
|
|
|
private javax.swing.JButton leftButton;
|
|
|
|
|
private javax.swing.JButton rightButton;
|
|
|
|
|
private javax.swing.JLabel statusLabel;
|
|
|
|
|
private javax.swing.JButton upButton;
|
2022-09-16 10:59:24 +04:00
|
|
|
|
// End of variables declaration//GEN-END:variables
|
|
|
|
|
}
|