Pibd-12 Pyzhov_E.A. LabWork01 Hard #1
1
.idea/.name
generated
Normal file
1
.idea/.name
generated
Normal file
@ -0,0 +1 @@
|
||||
Main.java
|
3
.idea/uiDesigner.xml
generated
3
.idea/uiDesigner.xml
generated
@ -119,6 +119,9 @@
|
||||
<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>
|
||||
<item class="FormCatamaran" icon="" removable="true" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="0" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -3,6 +3,7 @@
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/Resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
|
BIN
ProjectCatamaran/Resources/30px_arrow_down.png
Normal file
BIN
ProjectCatamaran/Resources/30px_arrow_down.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 244 B |
BIN
ProjectCatamaran/Resources/30px_arrow_left.png
Normal file
BIN
ProjectCatamaran/Resources/30px_arrow_left.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 249 B |
BIN
ProjectCatamaran/Resources/30px_arrow_right.png
Normal file
BIN
ProjectCatamaran/Resources/30px_arrow_right.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 254 B |
BIN
ProjectCatamaran/Resources/30px_arrow_up.png
Normal file
BIN
ProjectCatamaran/Resources/30px_arrow_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 257 B |
6
ProjectCatamaran/src/DirectionType.java
Normal file
6
ProjectCatamaran/src/DirectionType.java
Normal file
@ -0,0 +1,6 @@
|
||||
public enum DirectionType {
|
||||
Up,
|
||||
Down,
|
||||
Left,
|
||||
Right
|
||||
}
|
180
ProjectCatamaran/src/DrawningCatamaran.java
Normal file
180
ProjectCatamaran/src/DrawningCatamaran.java
Normal file
@ -0,0 +1,180 @@
|
||||
import java.awt.*;
|
||||
import java.util.Random;
|
||||
|
||||
public class DrawningCatamaran {
|
||||
private EntityCatamaran entityCatamaran;
|
||||
public EntityCatamaran getEntityCatamaran() {
|
||||
return entityCatamaran;
|
||||
}
|
||||
private Integer _pictureWidth;
|
||||
private Integer _pictureHeight;
|
||||
private Integer _startPosX;
|
||||
private Integer _startPosY;
|
||||
private final int _drawingCatamaranWidth = 120;
|
||||
private final int _drawingCatamaranHeight = 70;
|
||||
public DrawningCatamaranPaddle _drawingCatamaranPaddle;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor, Color additionalColor, boolean floaters, boolean sail) {
|
||||
entityCatamaran = new EntityCatamaran();
|
||||
entityCatamaran.Init(speed, weight, bodyColor, additionalColor, floaters, sail);
|
||||
_startPosY = null;
|
||||
_startPosX = null;
|
||||
_pictureWidth = null;
|
||||
_pictureHeight = null;
|
||||
|
||||
_drawingCatamaranPaddle = new DrawningCatamaranPaddle();
|
||||
Random random = new Random();
|
||||
int paddlesCount = random.nextInt(1,4);
|
||||
_drawingCatamaranPaddle.setEnumNumber(paddlesCount);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setPosition(int x, int y) {
|
||||
if (_pictureHeight == null || _pictureWidth == null)
|
||||
return;
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
if (_drawingCatamaranWidth + x > _pictureWidth || x < 0) {
|
||||
_startPosX = 0;
|
||||
}
|
||||
if (_drawingCatamaranHeight + y > _pictureHeight || y < 0) {
|
||||
_startPosY = 0;
|
||||
}
|
||||
}
|
||||
public boolean setPictureSize(int width, int height) {
|
||||
|
||||
if (_drawingCatamaranHeight > height || _drawingCatamaranWidth > width)
|
||||
return false;
|
||||
_pictureHeight = height;
|
||||
_pictureWidth = width;
|
||||
|
||||
if (_startPosX != null && _startPosY != null)
|
||||
{
|
||||
if (_startPosX + _drawingCatamaranWidth > width)
|
||||
_startPosX = width - _drawingCatamaranWidth;
|
||||
if (_startPosY + _drawingCatamaranHeight > height)
|
||||
_startPosY = height - _drawingCatamaranHeight;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public boolean moveTransport(DirectionType direction) {
|
||||
if (entityCatamaran == null || _pictureWidth == null || _pictureHeight == null)
|
||||
return false;
|
||||
switch (direction) {
|
||||
case Left:
|
||||
if (_startPosX - entityCatamaran.Step() > 0)
|
||||
_startPosX -= (int) entityCatamaran.Step();
|
||||
return true;
|
||||
case Up:
|
||||
if (_startPosY - entityCatamaran.Step() > 0)
|
||||
_startPosY -= (int) entityCatamaran.Step();
|
||||
return true;
|
||||
case Right:
|
||||
if (_startPosX + entityCatamaran.Step() < _pictureWidth - _drawingCatamaranWidth)
|
||||
_startPosX += (int) entityCatamaran.Step();
|
||||
return true;
|
||||
case Down:
|
||||
if (_startPosY + entityCatamaran.Step() < _pictureHeight - _drawingCatamaranHeight)
|
||||
_startPosY += (int) entityCatamaran.Step();
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
private void drawFloater(int y0, Color additionalColor, Graphics g2d)
|
||||
{
|
||||
g2d.setColor(additionalColor);
|
||||
Point[] floater = new Point[]
|
||||
{
|
||||
new Point(_startPosX + 10, _startPosY + y0 + 6),
|
||||
new Point(_startPosX + 90, _startPosY + y0 + 6),
|
||||
new Point(_startPosX + 110, _startPosY + y0 + 3),
|
||||
new Point(_startPosX + 90, _startPosY + y0),
|
||||
new Point(_startPosX + 10, _startPosY + y0),
|
||||
|
||||
};
|
||||
Polygon floaterPolygon = new Polygon();
|
||||
for (Point point: floater) {
|
||||
floaterPolygon.addPoint(point.x, point.y);
|
||||
}
|
||||
g2d.fillPolygon(floaterPolygon);
|
||||
g2d.drawPolygon(floaterPolygon);
|
||||
}
|
||||
|
||||
public void drawCatamaran(Graphics g) {
|
||||
if (entityCatamaran == null || _startPosX == null || _startPosY == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
|
||||
Point[] catamaranBorders = new Point[] {
|
||||
new Point(_startPosX + 10, _startPosY + 20),
|
||||
new Point(_startPosX + 80, _startPosY + 20),
|
||||
new Point(_startPosX + 107, _startPosY + 40),
|
||||
new Point(_startPosX + 80, _startPosY + 55),
|
||||
new Point(_startPosX + 10, _startPosY + 55)
|
||||
};
|
||||
|
||||
Polygon catamaranPolygon = new Polygon();
|
||||
for(Point point : catamaranBorders)
|
||||
catamaranPolygon.addPoint(point.x, point.y);
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.draw(catamaranPolygon);
|
||||
g2d.setColor(entityCatamaran.getBodyColor());
|
||||
g2d.fill(catamaranPolygon);
|
||||
|
||||
int ellipseX = _startPosX + 17;
|
||||
int ellipseY = _startPosY + 24;
|
||||
int ellipseWidth = 65;
|
||||
int ellipseHeight = 27;
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.drawOval(ellipseX, ellipseY, ellipseWidth, ellipseHeight);
|
||||
g2d.setColor(Color.WHITE);
|
||||
g2d.fillOval(ellipseX, ellipseY, ellipseWidth, ellipseHeight);
|
||||
|
||||
|
||||
if (entityCatamaran.getFloaters()) {
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.drawLine(_startPosX+20, _startPosY+20, _startPosX + 20, _startPosY+17);
|
||||
g2d.drawLine(_startPosX+80, _startPosY+20, _startPosX + 80, _startPosY+17);
|
||||
g2d.drawLine(_startPosX+20, _startPosY+55, _startPosX + 20, _startPosY+58);
|
||||
g2d.drawLine(_startPosX+80, _startPosY+55, _startPosX + 80, _startPosY+58);
|
||||
|
||||
drawFloater(11, entityCatamaran.getAdditionalColor(), g2d);
|
||||
drawFloater(58, entityCatamaran.getAdditionalColor(), g2d);
|
||||
}
|
||||
_drawingCatamaranPaddle.drawCatamaranPaddles(g, entityCatamaran.getBodyColor(), _startPosX, _startPosY);
|
||||
if (entityCatamaran.getSail()) {
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.setStroke(new BasicStroke(1));
|
||||
Point[] sail = new Point[] {
|
||||
new Point(_startPosX + 50, _startPosY + 45),
|
||||
new Point(_startPosX + 35, _startPosY + 39),
|
||||
new Point(_startPosX + 35, _startPosY + 24),
|
||||
new Point(_startPosX + 50, _startPosY + 18),
|
||||
new Point(_startPosX + 50, _startPosY + 43),
|
||||
};
|
||||
Polygon sailPolygon = new Polygon();
|
||||
for(Point point: sail) {
|
||||
sailPolygon.addPoint(point.x, point.y);
|
||||
}
|
||||
g2d.drawPolygon(sailPolygon);
|
||||
g2d.setColor(entityCatamaran.getAdditionalColor());
|
||||
g2d.fillPolygon(sailPolygon);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
34
ProjectCatamaran/src/DrawningCatamaranPaddle.java
Normal file
34
ProjectCatamaran/src/DrawningCatamaranPaddle.java
Normal file
@ -0,0 +1,34 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class DrawningCatamaranPaddle {
|
||||
private PaddlesCount _paddlesCount;
|
||||
|
||||
|
||||
public void setEnumNumber(int paddlesCount) {
|
||||
for (PaddlesCount value : PaddlesCount.values()) {
|
||||
if (value.getEnumNumber() == paddlesCount) {
|
||||
_paddlesCount = value;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void drawCatamaranPaddles(Graphics g, Color color, float startPosX, float startPosY) {
|
||||
|
||||
Graphics2D g2d = (Graphics2D) g;
|
||||
g2d.setColor(color);
|
||||
g2d.setStroke(new BasicStroke(4));
|
||||
int distanceBetweenPaddles = 27;
|
||||
for (int i = 0; i < _paddlesCount.getEnumNumber(); i++) {
|
||||
int posX = (int)(startPosX + i * distanceBetweenPaddles); // Позиция X для текущей пары весел
|
||||
drawPaddlePair(g2d, posX, (int)startPosY + 5);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
private void drawPaddlePair(Graphics2D g2d, int posX, int posY) {
|
||||
g2d.drawLine(posX + 20, posY + 15, posX + 5, posY); // Рисуем левое весло
|
||||
g2d.drawLine(posX + 20, posY + 50, posX + 5, posY + 65); // Рисуем правое весло
|
||||
}
|
||||
}
|
41
ProjectCatamaran/src/EntityCatamaran.java
Normal file
41
ProjectCatamaran/src/EntityCatamaran.java
Normal file
@ -0,0 +1,41 @@
|
||||
import java.awt.*;
|
||||
|
||||
public class EntityCatamaran {
|
||||
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 Sail;
|
||||
public boolean getSail() {
|
||||
return Sail;
|
||||
}
|
||||
private boolean Floaters;
|
||||
public boolean getFloaters() {
|
||||
return Floaters;
|
||||
}
|
||||
public void Init(int speed, double weight, Color bodyColor, Color additionalColor, boolean sail, boolean floaters) {
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
BodyColor = bodyColor;
|
||||
AdditionalColor = additionalColor;
|
||||
Sail = sail;
|
||||
Floaters = floaters;
|
||||
}
|
||||
}
|
93
ProjectCatamaran/src/FormCatamaran.form
Normal file
93
ProjectCatamaran/src/FormCatamaran.form
Normal 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="FormCatamaran">
|
||||
<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="599" height="476"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="1ff9a" binding="PictureBox" layout-manager="GridLayoutManager" row-count="4" 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="a8c2" class="javax.swing.JButton" binding="buttonCreate">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="2" 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="7b40c">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="2" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="3dc0" class="javax.swing.JButton" binding="buttonDown">
|
||||
<constraints>
|
||||
<grid row="3" 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="30px_arrow_down.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="abaeb">
|
||||
<constraints>
|
||||
<grid row="2" column="1" row-span="2" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="ccb2a" class="javax.swing.JButton" binding="buttonUp">
|
||||
<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="30px_arrow_up.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="fe25b" class="javax.swing.JButton" binding="buttonLeft">
|
||||
<constraints>
|
||||
<grid row="3" 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="30px_arrow_left.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="86d84" class="javax.swing.JButton" binding="buttonRight">
|
||||
<constraints>
|
||||
<grid row="3" 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="30px_arrow_right.png"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
114
ProjectCatamaran/src/FormCatamaran.java
Normal file
114
ProjectCatamaran/src/FormCatamaran.java
Normal file
@ -0,0 +1,114 @@
|
||||
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 FormCatamaran extends JFrame {
|
||||
protected DrawningCatamaran _drawningCatamaran = new DrawningCatamaran();
|
||||
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 FormCatamaran() {
|
||||
buttonUp.setName("buttonUp");
|
||||
buttonDown.setName("buttonDown");
|
||||
buttonLeft.setName("buttonLeft");
|
||||
buttonRight.setName("buttonRight");
|
||||
|
||||
InitializeControlsRepaintList();
|
||||
|
||||
buttonCreate.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_drawningCatamaran = new DrawningCatamaran();
|
||||
Random random = new Random();
|
||||
|
||||
_drawningCatamaran.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() );
|
||||
_drawningCatamaran.setPictureSize(PictureBox.getWidth(), PictureBox.getHeight());
|
||||
_drawningCatamaran.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 = _drawningCatamaran.moveTransport(DirectionType.Up);
|
||||
}
|
||||
break;
|
||||
case "buttonDown": {
|
||||
result = _drawningCatamaran.moveTransport(DirectionType.Down);
|
||||
}
|
||||
break;
|
||||
case "buttonLeft": {
|
||||
result = _drawningCatamaran.moveTransport(DirectionType.Left);
|
||||
}
|
||||
break;
|
||||
case "buttonRight": {
|
||||
result = _drawningCatamaran.moveTransport(DirectionType.Right);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
if (result)
|
||||
Draw();
|
||||
|
||||
}
|
||||
};
|
||||
buttonRight.addActionListener(buttonMoveClickedListener);
|
||||
buttonDown.addActionListener(buttonMoveClickedListener);
|
||||
buttonLeft.addActionListener(buttonMoveClickedListener);
|
||||
buttonUp.addActionListener(buttonMoveClickedListener);
|
||||
|
||||
}
|
||||
private void Draw() {
|
||||
if (_drawningCatamaran.getEntityCatamaran() == 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());
|
||||
_drawningCatamaran.drawCatamaran(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);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,9 +1,19 @@
|
||||
import javax.swing.*;
|
||||
|
||||
//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
|
||||
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
JFrame.setDefaultLookAndFeelDecorated(false);
|
||||
JFrame frame = new JFrame("Катамаран");
|
||||
frame.setContentPane(new FormCatamaran().PanelWrapper);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setLocation(500, 200);
|
||||
frame.pack();
|
||||
frame.setSize(700, 500);
|
||||
frame.setVisible(true);
|
||||
//TIP Press <shortcut actionId="ShowIntentionActions"/> with your caret at the highlighted text
|
||||
// to see how IntelliJ IDEA suggests fixing it.
|
||||
System.out.println("Hello and welcome!");
|
||||
|
||||
}
|
||||
}
|
14
ProjectCatamaran/src/PaddlesCount.java
Normal file
14
ProjectCatamaran/src/PaddlesCount.java
Normal file
@ -0,0 +1,14 @@
|
||||
public enum PaddlesCount {
|
||||
One(1),
|
||||
Two(2),
|
||||
Three(3);
|
||||
|
||||
final private int EnumNumber;
|
||||
PaddlesCount(int enumNumber) {
|
||||
EnumNumber = enumNumber;
|
||||
}
|
||||
public int getEnumNumber() {
|
||||
return EnumNumber;
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user