Добавлена новая форма, необходимо реализовать логику

This commit is contained in:
Никита Потапов 2023-10-20 16:22:20 +04:00
parent 26b0c2c0a2
commit b04f8401c3
2 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ProjectStormtrooper.FormPlaneCollection">
<grid id="27dc6" binding="PanelWrapper" layout-manager="BorderLayout" hgap="0" vgap="0">
<constraints>
<xy x="20" y="20" width="666" height="454"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="5f693" binding="PictureBoxCollection" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints border-constraint="Center"/>
<properties/>
<border type="none"/>
<children/>
</grid>
<grid id="7baef" binding="GroupBoxInstruments" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints border-constraint="East"/>
<properties/>
<border type="none"/>
<children>
<component id="c9ec0" class="javax.swing.JButton" binding="buttonAddPlane">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Добавить самолет"/>
</properties>
</component>
<vspacer id="82bd6">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<component id="17d80" class="javax.swing.JTextField" binding="textFieldNumber">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="639f2" class="javax.swing.JButton" binding="buttonRemovePlane">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Удалить самолет"/>
</properties>
</component>
<component id="86611" class="javax.swing.JButton" binding="buttonRefreshCollection">
<constraints>
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Обновить коллекцию"/>
</properties>
</component>
<vspacer id="75ae2">
<constraints>
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
<vspacer id="7b32d">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
</constraints>
</vspacer>
</children>
</grid>
</children>
</grid>
</form>

View File

@ -0,0 +1,34 @@
package ProjectStormtrooper;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
public class FormPlaneCollection {
PlanesGenericCollection<DrawingPlane, DrawingObjectPlane> _planes;
private JPanel PanelWrapper;
private JPanel GroupBoxInstruments;
private JPanel PictureBoxCollection;
private JButton buttonAddPlane;
private JTextField textFieldNumber;
private JButton buttonRemovePlane;
private JButton buttonRefreshCollection;
public FormPlaneCollection() {
_planes = new PlanesGenericCollection<>(PictureBoxCollection.getWidth(), PictureBoxCollection.getHeight());
buttonAddPlane.addActionListener(this::buttonAddPlaneClicked);
buttonRemovePlane.addActionListener(this::buttonRemovePlaneClicked);
buttonRefreshCollection.addActionListener(this::buttonRefreshCollectionClicked);
}
public void buttonAddPlaneClicked(ActionEvent e) {
//todo
}
public void buttonRemovePlaneClicked(ActionEvent e) {
//todo
}
public void buttonRefreshCollectionClicked(ActionEvent e) {
Graphics g = PictureBoxCollection.getGraphics();
_planes.ShowPlanes(g);
}
}