PIBD-12_Morozov_D.V. LabWork№1 #2

Closed
MorozovDanil wants to merge 3 commits from Lab01 into main
32 changed files with 889 additions and 0 deletions
Showing only changes of commit 953ec4b8ce - Show all commits

124
.idea/uiDesigner.xml Normal file
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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ProjectContainerShip.iml" filepath="$PROJECT_DIR$/ProjectContainerShip.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

View File

@ -0,0 +1,15 @@
package ProjectContainerShip.src;
public enum DeckCount {
One(1),
Two(2),
Three(3);
final private int EnumNumber;
DeckCount(int enumNumber) {
EnumNumber = enumNumber;
}
public int getEnumNumber() {
return EnumNumber;
}
}

View File

@ -0,0 +1,8 @@
package ProjectContainerShip.src;
public enum DirectionType {
Up,
Down,
Left,
Right
}

View File

@ -0,0 +1,188 @@
package ProjectContainerShip.src;
import java.awt.*;
import java.util.Random;
public class DrawningContainerShip {
private EntityContainerShip entityContainerShip;
public EntityContainerShip getEntityContainerShip() {
return entityContainerShip;
}
private Integer _pictureWidth;
private Integer _pictureHeight;
private Integer _startPosX;
private Integer _startPosY;
private final int _drawingContainerShipWidth = 130;
private final int _drawingContainerShipHeight = 60;
public DrawningContainerShipDeck _drawingContainerShipDeck;
public void Init(int speed, float weight, Color bodyColor, Color additionalColor, boolean crane, boolean container) {
entityContainerShip = new EntityContainerShip();
entityContainerShip.Init(speed, weight, bodyColor, additionalColor, crane, container);
_startPosY = null;
_startPosX = null;
_pictureWidth = null;
_pictureHeight = null;
_drawingContainerShipDeck = new DrawningContainerShipDeck();
Random random = new Random();
int deckCount = random.nextInt(1,4);
_drawingContainerShipDeck.setEnumNumber(deckCount);
}
public void setPosition(int x, int y) {
if (_pictureHeight == null || _pictureWidth == null)
return;
_startPosX = x;
_startPosY = y;
if (_drawingContainerShipWidth + x > _pictureWidth || x < 0) {
_startPosX = 0;
}
if (_drawingContainerShipHeight + y > _pictureHeight || y < 0) {
_startPosY = 0;
}
}
public boolean setPictureSize(int width, int height) {
if (_drawingContainerShipHeight > height || _drawingContainerShipWidth > width)
return false;
_pictureHeight = height;
_pictureWidth = width;
if (_startPosX != null && _startPosY != null)
{
if (_startPosX + _drawingContainerShipWidth > width)
_startPosX = width - _drawingContainerShipWidth;
if (_startPosY + _drawingContainerShipHeight > height)
_startPosY = height - _drawingContainerShipHeight;
}
return true;
}
public boolean moveTransport(DirectionType direction) {
if (entityContainerShip == null || _pictureWidth == null || _pictureHeight == null)
return false;
switch (direction) {
case Left:
if (_startPosX - entityContainerShip.Step() > 0)
_startPosX -= (int) entityContainerShip.Step();
return true;
case Up:
if (_startPosY - entityContainerShip.Step() > 0)
_startPosY -= (int) entityContainerShip.Step();
return true;
case Right:
if (_startPosX + entityContainerShip.Step() < _pictureWidth - _drawingContainerShipWidth)
_startPosX += (int) entityContainerShip.Step();
return true;
case Down:
if (_startPosY + entityContainerShip.Step() < _pictureHeight - _drawingContainerShipHeight)
_startPosY += (int) entityContainerShip.Step();
return true;
default:
return false;
}
}
// тут рисовашки
private void drawCrane(Color additionalColor, Graphics g2d)
{
g2d.setColor(additionalColor);
Point[] crane = new Point[]
{
new Point(_startPosX + 75, _startPosY + 50),
new Point(_startPosX + 85, _startPosY+ 50),
new Point(_startPosX + 85, _startPosY + 20),
new Point(_startPosX + 105, _startPosY + 20),
new Point(_startPosX + 105, _startPosY + 15),
new Point(_startPosX + 75, _startPosY + 15),
};
Polygon cranePolygon = new Polygon();
for (Point point: crane) {
cranePolygon.addPoint(point.x, point.y);
}
g2d.fillPolygon(cranePolygon);
g2d.drawPolygon(cranePolygon);
}
private void drawContainer(Color additionalColor, Graphics g2d)
{
g2d.setColor(Color.BLACK);
Point[] container1 = new Point[] {
new Point(_startPosX + 90, _startPosY + 50),
new Point(_startPosX + 120, _startPosY + 50),
new Point(_startPosX + 120, _startPosY + 40),
new Point(_startPosX + 90, _startPosY + 40)
};
Polygon container1Polygon = new Polygon();
for(Point point: container1) {
container1Polygon.addPoint(point.x, point.y);
}
Point[] container2 = new Point[] {
new Point(_startPosX + 90, _startPosY + 40),
new Point(_startPosX + 90, _startPosY + 30),
new Point(_startPosX + 120, _startPosY + 30),
new Point(_startPosX + 120, _startPosY + 40)
};
Polygon container2Polygon = new Polygon();
for(Point point: container1) {
container2Polygon.addPoint(point.x, point.y);
}
g2d.drawPolygon(container1Polygon);
g2d.drawPolygon(container2Polygon);
g2d.setColor(entityContainerShip.getAdditionalColor());
g2d.fillPolygon(container1Polygon);
g2d.fillPolygon(container2Polygon);
}
public void drawContainerShip(Graphics g) {
if (entityContainerShip == null || _startPosX == null || _startPosY == null) {
return;
}
Graphics2D g2d = (Graphics2D) g;
Point[] containerShipBorders = new Point[] {
new Point(_startPosX, _startPosY + 50),
new Point(_startPosX + 20, _startPosY + 70),
new Point(_startPosX + 110, _startPosY + 70),
new Point(_startPosX + 130, _startPosY + 50)
};
Polygon containerShipPolygon = new Polygon();
for(Point point : containerShipBorders)
containerShipPolygon.addPoint(point.x, point.y);
g2d.setColor(Color.BLACK);
g2d.draw(containerShipPolygon);
g2d.setColor(entityContainerShip.getBodyColor());
g2d.fill(containerShipPolygon);
if (entityContainerShip.getCrane()) {
drawCrane( entityContainerShip.getAdditionalColor(), g2d);
}
if (entityContainerShip.getContainer()) {
drawContainer( entityContainerShip.getAdditionalColor(), g2d);
}
_drawingContainerShipDeck.drawContainerShipDeck(g, entityContainerShip.getBodyColor(), _startPosX, _startPosY);
}
}

View File

@ -0,0 +1,32 @@
package ProjectContainerShip.src;
import java.awt.*;
public class DrawningContainerShipDeck {
private DeckCount _deckCount;
public void setEnumNumber(int deckCount) {
for (DeckCount value : DeckCount.values()) {
if (value.getEnumNumber() == deckCount) {
_deckCount = value;
return;
}
}
}
public void drawContainerShipDeck(Graphics g, Color color, float startPosX, float startPosY)
{
Graphics2D g2d = (Graphics2D) g;
g2d.setColor(color);
g2d.setStroke(new BasicStroke(4));
for (int i = 0; i < _deckCount.getEnumNumber(); i++) {
drawDeck(g2d, (int) startPosX, (int)startPosY);
startPosY-=10;
}
}
private void drawDeck(Graphics2D g2d, int posX, int posY) {
g2d.drawLine(posX + 10, posY + 50, posX + 60, posY + 50);
g2d.drawLine(posX + 60, posY + 50, posX + 60, posY + 40);
g2d.drawLine(posX + 60, posY + 40, posX + 10, posY + 40);
g2d.drawLine(posX + 10, posY + 40, posX + 10, posY + 50);
}
}

View File

@ -0,0 +1,55 @@
package ProjectContainerShip.src;
import java.awt.*;
public class EntityContainerShip {
// скорость
private int Speed;
public int getSpeed() {
return Speed;
}
// вес
private double Weight;
public double getWeight() {
return Weight;
}
// основной цвет
private Color BodyColor;
public Color getBodyColor() {
return BodyColor;
}
// доп цвет
private Color AdditionalColor;
public Color getAdditionalColor() {
return AdditionalColor;
}
// шаг
public double Step() {
return Speed*100/Weight;
}
// доп опция кран
private boolean Crane;
public boolean getCrane() {
return Crane;
}
// доп опция контейнер
private boolean Container;
public boolean getContainer() {
return Container;
}
// инициализация полей обьекта
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean crane, boolean container) {
Speed = speed;
Weight = weight;
BodyColor = bodyColor;
AdditionalColor = additionalColor;
Crane = crane;
Container = container;
}
}

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="ProjectContainerShip.src.FormContainerShip">
<grid id="27dc6" binding="PanelWrapper" 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>
<xy x="20" y="20" width="500" height="400"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<grid id="34630" binding="PictureBox" layout-manager="GridLayoutManager" row-count="3" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="b0a96" class="javax.swing.JButton" binding="buttonCreate">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="2" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Создать"/>
</properties>
</component>
<vspacer id="78215">
<constraints>
<grid row="0" 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="31c3f" class="javax.swing.JButton" binding="buttonDown">
<constraints>
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="30" height="30"/>
<preferred-size width="30" height="30"/>
<maximum-size width="30" height="30"/>
</grid>
</constraints>
<properties>
<icon value="ProjectContainerShip/Resources/30px_arrow_down.png"/>
<text value=""/>
</properties>
</component>
<hspacer id="b5bb2">
<constraints>
<grid row="2" column="1" 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="6deee" class="javax.swing.JButton" binding="buttonRight">
<constraints>
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="30" height="30"/>
<preferred-size width="30" height="30"/>
<maximum-size width="30" height="30"/>
</grid>
</constraints>
<properties>
<icon value="ProjectContainerShip/Resources/30px_arrow_right.png"/>
<text value=""/>
</properties>
</component>
<component id="f5ad2" class="javax.swing.JButton" binding="buttonLeft">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="30" height="30"/>
<preferred-size width="30" height="30"/>
<maximum-size width="30" height="30"/>
</grid>
</constraints>
<properties>
<icon value="ProjectContainerShip/Resources/30px_arrow_left.png"/>
<text value=""/>
</properties>
</component>
<component id="e26e8" class="javax.swing.JButton" binding="buttonUp">
<constraints>
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
<minimum-size width="30" height="30"/>
<preferred-size width="30" height="30"/>
<maximum-size width="30" height="30"/>
</grid>
</constraints>
<properties>
<icon value="ProjectContainerShip/Resources/30px_arrow_up.png"/>
<text value=""/>
</properties>
</component>
</children>
</grid>
</children>
</grid>
</form>

View File

@ -0,0 +1,116 @@
package ProjectContainerShip.src;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.LinkedList;
import java.util.Random;
import java.util.List;
public class FormContainerShip extends JFrame {
protected DrawningContainerShip _drawningContainerShip = new DrawningContainerShip();
JPanel PanelWrapper;
private JPanel PictureBox;
private JButton buttonCreate;
private JButton buttonRight;
private JButton buttonDown;
private JButton buttonLeft;
private JButton buttonUp;
private List<JComponent> controls;
public FormContainerShip() {
buttonUp.setName("buttonUp");
buttonDown.setName("buttonDown");
buttonLeft.setName("buttonLeft");
buttonRight.setName("buttonRight");
InitializeControlsRepaintList();
buttonCreate.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
_drawningContainerShip = new DrawningContainerShip();
Random random = new Random();
_drawningContainerShip.Init(random.nextInt(30, 100),
random.nextInt(100, 500),
new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256)),
new Color(random.nextInt(256), random.nextInt(256), random.nextInt(256)),
random.nextBoolean(), random.nextBoolean() );
_drawningContainerShip.setPictureSize(PictureBox.getWidth(), PictureBox.getHeight());
_drawningContainerShip.setPosition(random.nextInt(25, 100),
random.nextInt(25, 100));
Draw();
}
});
ActionListener buttonMoveClickedListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String buttonName = ((JButton) e.getSource()).getName();
boolean result = false;
switch (buttonName) {
case "buttonUp": {
result = _drawningContainerShip.moveTransport(DirectionType.Up);
}
break;
case "buttonDown": {
result = _drawningContainerShip.moveTransport(DirectionType.Down);
}
break;
case "buttonLeft": {
result = _drawningContainerShip.moveTransport(DirectionType.Left);
}
break;
case "buttonRight": {
result = _drawningContainerShip.moveTransport(DirectionType.Right);
}
break;
}
if (result)
Draw();
}
};
buttonRight.addActionListener(buttonMoveClickedListener);
buttonDown.addActionListener(buttonMoveClickedListener);
buttonLeft.addActionListener(buttonMoveClickedListener);
buttonUp.addActionListener(buttonMoveClickedListener);
}
private void Draw() {
if (_drawningContainerShip.getEntityContainerShip() == null)
return;
if (PictureBox.getWidth() == 0 || PictureBox.getHeight() == 0) {
return;
}
Graphics g = PictureBox.getGraphics();
g.setColor(PictureBox.getBackground());
g.fillRect(0,0, PictureBox.getWidth(), PictureBox.getHeight());
_drawningContainerShip.drawContainerShip(g);
RepaintControls();
}
private void RepaintControls() {
for (JComponent control : controls) {
control.repaint();
}
}
private void InitializeControlsRepaintList() {
controls = new LinkedList<>();
controls.add(buttonCreate);
controls.add(buttonUp);
controls.add(buttonDown);
controls.add(buttonLeft);
controls.add(buttonRight);
}
}

26
out/production/Lab(HARD)/.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
# ---> Java
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
</content>
<orderEntry type="jdk" jdkName="21" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/Lab(HARD).iml" filepath="$PROJECT_DIR$/.idea/Lab(HARD).iml" />
</modules>
</component>
</project>

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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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.svg" 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,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,29 @@
### IntelliJ IDEA ###
out/
!**/src/main/**/out/
!**/src/test/**/out/
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="openjdk-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ProjectContainerShip.iml" filepath="$PROJECT_DIR$/ProjectContainerShip.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 254 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 257 B

View File

@ -0,0 +1,2 @@
# PIBD-12_Morozov_D.V._Hard