Добавление всех классов и формы.

This commit is contained in:
Programmist73 2022-11-03 22:02:58 +04:00
parent c70c9a62fb
commit 4b8ad33fb5
13 changed files with 659 additions and 0 deletions

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@ -0,0 +1,16 @@
public enum Additional_Enum {
One(1),
Two(2),
Three(3);
private final int addEnum;
Additional_Enum(int i)
{
this.addEnum = i;
}
public int GetAddEnum(){
return addEnum;
}
}

View File

@ -0,0 +1,17 @@
public enum Direction {
Up(1),
Down(2),
Left(3),
Right(4);
private final int DirectionCode;
private Direction(int directionCode)
{
this.DirectionCode = directionCode;
}
public int GetDirect(){
return DirectionCode;
}
}

View File

@ -0,0 +1,55 @@
import javax.swing.*;
import java.awt.*;
public class DrawingAirplaneWindow extends JComponent
{
private Additional_Enum _airplaneWindowEnum;
public void SetAddEnum(int decksAmount) {
for(Additional_Enum item : _airplaneWindowEnum.values())
{
if(item.GetAddEnum() == decksAmount)
{
_airplaneWindowEnum = item;
return;
}
}
}
public void DrawAirplaneWindow(Color colorWindow, Graphics g, float _startPosX, float _startPosY)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
switch(_airplaneWindowEnum.GetAddEnum())
{
case 1:
g2d.setPaint(colorWindow);
g2d.fillOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
g2d.setPaint(Color.BLACK);
g2d.drawOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
break;
case 2:
g2d.setPaint(colorWindow);
g2d.fillOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
g2d.fillOval((int)_startPosX + 18, (int)_startPosY + 11, 6, 4);
g2d.setPaint(Color.BLACK);
g2d.drawOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
g2d.drawOval((int)_startPosX + 18, (int)_startPosY + 11, 6, 4);
break;
case 3:
g2d.setPaint(colorWindow);
g2d.fillOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
g2d.fillOval((int)_startPosX + 18, (int)_startPosY + 11, 6, 4);
g2d.fillOval((int)_startPosX + 27, (int)_startPosY + 11, 6, 4);
g2d.setPaint(Color.BLACK);
g2d.drawOval((int)_startPosX + 9, (int)_startPosY + 11, 6, 4);
g2d.drawOval((int)_startPosX + 18, (int)_startPosY + 11, 6, 4);
g2d.drawOval((int)_startPosX + 27, (int)_startPosY + 11, 6, 4);
break;
}
}
}

View File

@ -0,0 +1,172 @@
import java.awt.*;
import java.awt.Color;
import java.util.Random;
public class DrawingPlane
{
public EntityPlane Airbus; //класс-сущность
public DrawingAirplaneWindow _airplaneWindow; //для дополнительной отрисовки
private float _startPosX; //левая координата отрисовки
private float _startPosY; //верхняя координата отрисовки
private Integer _pictureWidth = null; //ширина окна отрисовки
private Integer _pictureHeight = null; //высота окна отрисовки
protected final int _airbusWidth = 50; //ширина отрисовки самолёта
protected final int _airbusHeight = 16; //высота отрисовки самолёта
//инициализаци свойств
public void Initial(int speed, float weight, Color corpusColor)
{
Airbus = new EntityPlane();
Airbus.Initial(speed, weight, corpusColor);
_airplaneWindow = new DrawingAirplaneWindow();
SetAddEnum();
}
//установка кол-ва иллюминаторов
public void SetAddEnum()
{
Random rnd = new Random();
int countWindow = rnd.nextInt(1, 4);
_airplaneWindow.SetAddEnum(countWindow);
}
public EntityPlane GetPlane()
{
return Airbus;
}
//установка координат позиции самолёта
public void SetPosition(int x, int y, int width, int height)
{
if (x < 0 || y < 0 || width <= x + _airbusWidth || height <= y + _airbusHeight)
{
_pictureHeight = null;
_pictureWidth = null;
return;
}
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
}
//изменение направления движения
public void MoveTransport(Direction direction)
{
if (GetPlane() == null)
{
return;
}
switch (direction)
{
case Right: //вправо
if (_startPosX + _airbusWidth + Airbus.GetStep() < _pictureWidth)
{
_startPosX += Airbus.GetStep();
}
break;
case Left: //влево
if (_startPosX - _airbusWidth - Airbus.GetStep() > 0)
{
_startPosX -= Airbus.GetStep();
}
break;
case Up: //вверх
if (_startPosY - _airbusHeight - Airbus.GetStep() > 0)
{
_startPosY -= Airbus.GetStep();
}
break;
case Down: //вниз
if (_startPosY + _airbusHeight + Airbus.GetStep() < _pictureHeight)
{
_startPosY += Airbus.GetStep();
}
break;
}
}
public void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0 || _pictureHeight == null || _pictureWidth == null)
{
return;
}
if(GetPlane() == null){
return;
}
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(Color.WHITE);
g2d.fillRect(0, 0, _pictureWidth, _pictureHeight);
//заливает фигуру
g2d.setPaint(Color.BLACK);
//крыло
g2d.fillRect((int)_startPosX + 10, (int)_startPosY + 15, 20, 2);
g2d.fillRect((int)_startPosX + 12, (int)_startPosY + 17, 16, 2);
//заднее поперечное крыло
g2d.fillOval((int)_startPosX - 3, (int)_startPosY + 7, 10, 5);
//задние шасси
g2d.fillRect((int)_startPosX + 10, (int)_startPosY + 21, 2, 2);
g2d.fillRect((int)_startPosX + 12, (int)_startPosY + 23, 4, 4);
g2d.fillRect((int)_startPosX + 8, (int)_startPosY + 23, 2, 4);
//переднее шасси
g2d.fillRect((int)_startPosX + 35, (int)_startPosY + 21, 2, 2);
g2d.fillRect((int)_startPosX + 35, (int)_startPosY + 23, 4, 4);
g2d.setColor(Color.BLACK); //рисует контур
//корпус
g2d.drawRect((int)_startPosX, (int)_startPosY + 10, 40, 10);
//хвостовое крыло
g2d.drawLine((int)_startPosX, (int)_startPosY + 10, (int)_startPosX, (int)_startPosY);
g2d.drawLine((int)_startPosX, (int)_startPosY, (int)_startPosX + 10, (int)_startPosY + 10);
//нос самолёта
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 15, (int)_startPosX + 50, (int)_startPosY + 16);
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 10, (int)_startPosX + 47, (int)_startPosY + 15);
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 20, (int)_startPosX + 50, (int)_startPosY + 15);
//отрисовка иллюминаторов
_airplaneWindow.DrawAirplaneWindow(Airbus.GetColor(), g, _startPosX, _startPosY);
}
//смена границ формы отрисовки
public void ChangeBorders(int width, int height)
{
_pictureWidth = width;
_pictureHeight = height;
if (_pictureWidth <= _airbusWidth || _pictureHeight <= _airbusHeight)
{
_pictureWidth = null;
_pictureHeight = null;
return;
}
if (_startPosX + _airbusWidth > _pictureWidth)
{
_startPosX = _pictureWidth - _airbusWidth;
}
if (_startPosY + _airbusHeight > _pictureHeight)
{
_startPosY = _pictureHeight - _airbusHeight;
}
}
}

View File

@ -0,0 +1,31 @@
import java.awt.*;
public class EntityPlane
{
public int Speed; //скорость
public int GetSpeed(){
return Speed;
}
public float Weight; //вес
public float GetWeight(){
return Weight;
}
public Color CorpusColor; //цвет корпуса
public Color GetColor(){
return CorpusColor;
}
//шаг перемещения самолёта
public float GetStep(){
return Speed * 100 / Weight;
}
public void Initial(int speed, float weight, Color corpusColor)
{
Speed = speed;
Weight = weight;
CorpusColor = corpusColor;
}
}

111
Project/src/FormAirbus.form Normal file
View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="FormAirbus">
<grid id="27dc6" binding="MainPanel" layout-manager="GridLayoutManager" row-count="3" column-count="7" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="42" width="864" height="483"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="67a15" class="javax.swing.JButton" binding="ButtonLeft">
<constraints>
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
</grid>
</constraints>
<properties>
<horizontalTextPosition value="0"/>
<text value=""/>
</properties>
</component>
<component id="b10a1" class="javax.swing.JButton" binding="ButtonRight">
<constraints>
<grid row="2" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
</grid>
</constraints>
<properties>
<horizontalTextPosition value="0"/>
<text value=""/>
</properties>
</component>
<hspacer id="5b756">
<constraints>
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="a48b0" class="javax.swing.JButton" binding="ButtonCreate">
<constraints>
<grid row="2" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="100" height="25"/>
<preferred-size width="100" height="25"/>
<maximum-size width="100" height="25"/>
</grid>
</constraints>
<properties>
<text value="Создать"/>
</properties>
</component>
<toolbar id="ede45" binding="StatusStrip">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="345" height="25"/>
<preferred-size width="345" height="25"/>
<maximum-size width="345" height="25"/>
</grid>
</constraints>
<properties/>
<border type="none"/>
<children/>
</toolbar>
<grid id="b0c9a" binding="PictureBox" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<grid row="0" column="0" row-span="1" col-span="7" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children/>
</grid>
<component id="51778" class="javax.swing.JButton" binding="ButtonDown">
<constraints>
<grid row="2" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
</grid>
</constraints>
<properties>
<horizontalTextPosition value="0"/>
<text value=""/>
</properties>
</component>
<component id="44002" class="javax.swing.JButton" binding="ButtonUp">
<constraints>
<grid row="1" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="45" height="45"/>
<preferred-size width="45" height="45"/>
<maximum-size width="45" height="45"/>
</grid>
</constraints>
<properties>
<horizontalTextPosition value="11"/>
<text value=""/>
</properties>
</component>
<hspacer id="993b6">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
<minimum-size width="220" height="25"/>
<preferred-size width="220" height="25"/>
<maximum-size width="220" height="25"/>
</grid>
</constraints>
</hspacer>
</children>
</grid>
</form>

120
Project/src/FormAirbus.java Normal file
View File

@ -0,0 +1,120 @@
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.util.Random;
public class FormAirbus
{
protected DrawingPlane plane = new DrawingPlane();
public JPanel MainPanel;
private JButton ButtonCreate;
private JButton ButtonLeft;
private JButton ButtonDown;
private JButton ButtonRight;
private JButton ButtonUp;
private JToolBar StatusStrip;
private JPanel PictureBox;
private JLabel LabelSpeed = new JLabel();
private JLabel LabelWeight = new JLabel();
private JLabel LabelColor = new JLabel();
public FormAirbus()
{
//создание строки отображения скорости, веса и цвета объекта
Box LableBox = Box.createHorizontalBox();
LableBox.setMinimumSize(new Dimension(1, 20));
LableBox.add(LabelSpeed);
LableBox.add(LabelWeight);
LableBox.add(LabelColor);
StatusStrip.add(LableBox);
try
{
Image img = ImageIO.read(getClass().getResource("resourses/Up.png"));
ButtonUp.setIcon(new ImageIcon(img));
img = ImageIO.read(getClass().getResource("resourses/Left.png"));
ButtonLeft.setIcon(new ImageIcon(img));
img = ImageIO.read(getClass().getResource("resourses/Down.png"));
ButtonDown.setIcon(new ImageIcon(img));
img = ImageIO.read(getClass().getResource("resourses/Right.png"));
ButtonRight.setIcon(new ImageIcon(img));
} catch (Exception ex){
System.out.println(ex.getMessage());
}
ButtonCreate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
plane = new DrawingPlane();
Random rnd = new Random();
plane.Initial(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
plane.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),
PictureBox.getWidth(), PictureBox.getHeight());
LabelSpeed.setText("Скорость: " + plane.GetPlane().GetSpeed() + " ");
LabelWeight.setText("Вес: " + plane.GetPlane().GetWeight() + " ");
LabelColor.setText("Цвет: r = " + plane.GetPlane().GetColor().getRed() + " g = " + plane.GetPlane().GetColor().getGreen() +
" b = " + plane.GetPlane().GetColor().getBlue());
Draw();
}
});
//обновление размеров формы
MainPanel.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(ComponentEvent e) {
super.componentResized(e);
plane.ChangeBorders(PictureBox.getWidth(), PictureBox.getHeight());
Draw();
}
});
ButtonUp.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
plane.MoveTransport(Direction.Up);
Draw();
}
});
ButtonLeft.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
plane.MoveTransport(Direction.Left);
Draw();
}
});
ButtonDown.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
plane.MoveTransport(Direction.Down);
Draw();
}
});
ButtonRight.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
plane.MoveTransport(Direction.Right);
Draw();
}
});
}
public void Draw()
{
if(plane.GetPlane() == null)
{
return;
}
plane.DrawTransport(PictureBox.getGraphics());
}
}

13
Project/src/Main.java Normal file
View File

@ -0,0 +1,13 @@
import javax.swing.*;
public class Main {
public static void main(String[] args) {
JFrame frame = new JFrame("Airbus");
frame.setContentPane(new FormAirbus().MainPanel);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setLocation(500, 200);
frame.pack();
frame.setSize(1000, 500);
frame.setVisible(true);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB