Compare commits
No commits in common. "Lab06" and "master" have entirely different histories.
@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public abstract class AbstractMap {
|
|
||||||
private IDrawingObject _drawningObject = null;
|
|
||||||
protected int[][] _map = null;
|
|
||||||
protected int _width;
|
|
||||||
protected int _height;
|
|
||||||
protected int _size_x;
|
|
||||||
protected int _size_y;
|
|
||||||
protected final Random _random = new Random();
|
|
||||||
protected final int _freeRoad = 0;
|
|
||||||
protected final int _barrier = 1;
|
|
||||||
|
|
||||||
public BufferedImage CreateMap(int width, int height, IDrawingObject drawningObject)
|
|
||||||
{
|
|
||||||
_width = width;
|
|
||||||
_height = height;
|
|
||||||
_drawningObject = drawningObject;
|
|
||||||
GenerateMap();
|
|
||||||
while (!SetObjectOnMap())
|
|
||||||
{
|
|
||||||
GenerateMap();
|
|
||||||
}
|
|
||||||
return DrawMapWithObject();
|
|
||||||
}
|
|
||||||
public BufferedImage MoveObject(Direction direction)
|
|
||||||
{
|
|
||||||
if (_drawningObject == null) return DrawMapWithObject();
|
|
||||||
boolean canMove = true;
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case LEFT:
|
|
||||||
if (!checkForBarriers(0, -1 * _drawningObject.getStep(), -1 * _drawningObject.getStep(), 0)) canMove = false;
|
|
||||||
break;
|
|
||||||
case RIGHT:
|
|
||||||
if (!checkForBarriers(0, _drawningObject.getStep(), _drawningObject.getStep(), 0)) canMove = false;
|
|
||||||
break;
|
|
||||||
case UP:
|
|
||||||
if (!checkForBarriers(-1 * _drawningObject.getStep(), 0, 0, -1 * _drawningObject.getStep())) canMove = false;
|
|
||||||
break;
|
|
||||||
case DOWN:
|
|
||||||
if (!checkForBarriers(_drawningObject.getStep(), 0, 0, _drawningObject.getStep())) canMove = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (canMove)
|
|
||||||
{
|
|
||||||
_drawningObject.MoveObject(direction);
|
|
||||||
}
|
|
||||||
return DrawMapWithObject();
|
|
||||||
}
|
|
||||||
private boolean SetObjectOnMap()
|
|
||||||
{
|
|
||||||
if (_drawningObject == null || _map == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
int x = _random.nextInt(0, 10);
|
|
||||||
int y = _random.nextInt(0, 10);
|
|
||||||
_drawningObject.SetObject(x, y, _width, _height);
|
|
||||||
if (!checkForBarriers(0,0,0,0)) return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
private BufferedImage DrawMapWithObject()
|
|
||||||
{
|
|
||||||
BufferedImage bmp = new BufferedImage(_width, _height, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
if (_drawningObject == null || _map == null)
|
|
||||||
{
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
Graphics2D gr = bmp.createGraphics();
|
|
||||||
for (int i = 0; i < _map.length; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _map[i].length; ++j)
|
|
||||||
{
|
|
||||||
if (_map[i][j] == _freeRoad)
|
|
||||||
{
|
|
||||||
DrawRoadPart(gr, i, j);
|
|
||||||
}
|
|
||||||
else if (_map[i][j] == _barrier)
|
|
||||||
{
|
|
||||||
DrawBarrierPart(gr, i, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_drawningObject.DrawingObject(gr);
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkForBarriers(float topOffset, float rightOffset, float leftOffset, float bottomOffset)
|
|
||||||
{
|
|
||||||
float[] position = _drawningObject.GetCurrentPosition();
|
|
||||||
int top = (int)((position[1] + topOffset) / _size_y);
|
|
||||||
int right = (int)((position[2] + rightOffset) / _size_x);
|
|
||||||
int left = (int)((position[0] + leftOffset) / _size_x);
|
|
||||||
int bottom = (int)((position[3] + bottomOffset) / _size_y);
|
|
||||||
if (top < 0 || left < 0 || right >= _map[0].length || bottom >= _map.length) return false;
|
|
||||||
for (int i = top; i <= bottom; i++)
|
|
||||||
{
|
|
||||||
for (int j = left; j <= right; j++)
|
|
||||||
{
|
|
||||||
if (_map[j][i] == 1) return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void GenerateMap();
|
|
||||||
protected abstract void DrawRoadPart(Graphics g, int i, int j);
|
|
||||||
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class CanvasMy extends JComponent {
|
|
||||||
public CanvasMy(){
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
private DrawingAirBomber _airBomber = null;
|
|
||||||
|
|
||||||
public void setAirBomber(DrawingAirBomber _airBomber) {
|
|
||||||
this._airBomber = _airBomber;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void paintComponent(Graphics g){
|
|
||||||
super.paintComponent(g);
|
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
|
||||||
if (_airBomber != null) _airBomber.DrawTransport(g2d);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class CityMap extends AbstractMap {
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка закрытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color barrierColor = Color.GRAY;
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка открытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color roadColor = Color.CYAN;
|
|
||||||
@Override
|
|
||||||
protected void DrawBarrierPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(barrierColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void DrawRoadPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(roadColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void GenerateMap()
|
|
||||||
{
|
|
||||||
_map = new int[100][100];
|
|
||||||
_size_x = _width / _map.length;
|
|
||||||
_size_y = _height / _map[0].length;
|
|
||||||
int buildingCounter = 0;
|
|
||||||
for (int i = 0; i < _map.length; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _map[0].length; ++j)
|
|
||||||
{
|
|
||||||
_map[i][j] = _freeRoad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (buildingCounter < 10)
|
|
||||||
{
|
|
||||||
int x = _random.nextInt(0, 89);
|
|
||||||
int y = _random.nextInt(0, 89);
|
|
||||||
int buildingWidth = _random.nextInt(2, 10);
|
|
||||||
int buildingHeight = _random.nextInt(2, 10);
|
|
||||||
if (x + buildingWidth >= _map.length) x = _random.nextInt(_map.length - buildingWidth - 1, _map.length);
|
|
||||||
if (y + buildingHeight >= _map[0].length) y = _random.nextInt(_map[0].length - buildingHeight - 1, _map[0].length);
|
|
||||||
|
|
||||||
boolean isFreeSpace = true;
|
|
||||||
for (int i = x; i < x + buildingWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = y; j < y + buildingHeight; j++)
|
|
||||||
{
|
|
||||||
if (_map[i][j] != _freeRoad)
|
|
||||||
{
|
|
||||||
isFreeSpace = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isFreeSpace)
|
|
||||||
{
|
|
||||||
for (int i = x; i < x + buildingWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = y; j < y + buildingHeight; j++)
|
|
||||||
{
|
|
||||||
_map[i][j] = _barrier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
buildingCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public enum Direction {
|
|
||||||
NONE,
|
|
||||||
UP,
|
|
||||||
DOWN,
|
|
||||||
LEFT,
|
|
||||||
RIGHT
|
|
||||||
}
|
|
@ -1,264 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.Random;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingAirBomber {
|
|
||||||
protected EntityAirBomber AirBomber;
|
|
||||||
public IDrawingObjectDop drawingEngines;
|
|
||||||
public int _startPosX;
|
|
||||||
public int _startPosY;
|
|
||||||
private Integer _pictureWidth = null;
|
|
||||||
private Integer _pictureHeight = null;
|
|
||||||
private int _airBomberWidth = 110;
|
|
||||||
private int _airBomberHeight = 100;
|
|
||||||
|
|
||||||
public DrawingAirBomber(int speed, float weight, Color bodyColor, int numberOfEngines, EnginesType enginesType){
|
|
||||||
AirBomber = new EntityAirBomber(speed, weight, bodyColor);
|
|
||||||
switch (enginesType) {
|
|
||||||
case RECTANGLE:
|
|
||||||
drawingEngines = new DrawingEngines();
|
|
||||||
break;
|
|
||||||
case TRIANGLE:
|
|
||||||
drawingEngines = new DrawingEnginesTriangle();
|
|
||||||
break;
|
|
||||||
case OVAL:
|
|
||||||
drawingEngines = new DrawingEnginesOval();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new AssertionError();
|
|
||||||
}
|
|
||||||
drawingEngines.setNumberOfEngines(numberOfEngines);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес бомбардировщика</param>
|
|
||||||
/// <param name="bodyColor">Цвет корпуса</param>
|
|
||||||
/// <param name="carWidth">Ширина отрисовки бомбардировщика</param>
|
|
||||||
/// <param name="carHeight">Высота отрисовки бомбардировщика</param>
|
|
||||||
protected DrawingAirBomber(int speed, float weight, Color bodyColor, int numberOfEngines, EnginesType enginesType, int airBomberWidth, int airBomberHeight)
|
|
||||||
{
|
|
||||||
this(speed, weight, bodyColor, numberOfEngines, enginesType);
|
|
||||||
this._airBomberWidth = airBomberWidth;
|
|
||||||
this._airBomberHeight = airBomberHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public EntityAirBomber getAirBomber() {
|
|
||||||
return AirBomber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height){
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (_pictureWidth == null || _pictureHeight == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Random rd = new Random();
|
|
||||||
_startPosX = x + _airBomberWidth >= _pictureWidth ? rd.nextInt(0, _pictureWidth - 1 - _airBomberWidth) : x;
|
|
||||||
_startPosY = y + _airBomberHeight >= _pictureHeight ? rd.nextInt(0, _pictureHeight - 1 - _airBomberHeight) : y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveTransport(Direction direction)
|
|
||||||
{
|
|
||||||
if (_pictureWidth == null || _pictureHeight == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
// вправо
|
|
||||||
case RIGHT:
|
|
||||||
if (_startPosX + _airBomberWidth + AirBomber.Step < _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX += AirBomber.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//влево
|
|
||||||
case LEFT:
|
|
||||||
if (_startPosX - AirBomber.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosX -= AirBomber.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вверх
|
|
||||||
case UP:
|
|
||||||
if (_startPosY - AirBomber.Step > 0)
|
|
||||||
{
|
|
||||||
_startPosY -= AirBomber.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
//вниз
|
|
||||||
case DOWN:
|
|
||||||
if (_startPosY + _airBomberHeight + AirBomber.Step < _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY += AirBomber.Step;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DrawTransport(Graphics2D g)
|
|
||||||
{
|
|
||||||
if (_startPosX < 0 || _startPosY < 0
|
|
||||||
|| _pictureHeight == null || _pictureWidth == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _startPosXInt = (int)_startPosX;
|
|
||||||
int _startPosYInt = (int)_startPosY;
|
|
||||||
|
|
||||||
//отрисовка двигателей
|
|
||||||
drawingEngines.drawEngines(g, _startPosXInt, _startPosYInt, AirBomber.getBodyColor());
|
|
||||||
|
|
||||||
//отрисовка кабины
|
|
||||||
int[] cabinX =
|
|
||||||
{
|
|
||||||
_startPosXInt + 5,
|
|
||||||
_startPosXInt + 20,
|
|
||||||
_startPosXInt + 20
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] cabinY =
|
|
||||||
{
|
|
||||||
_startPosYInt + 50,
|
|
||||||
_startPosYInt + 40,
|
|
||||||
_startPosYInt + 60
|
|
||||||
};
|
|
||||||
|
|
||||||
g.fillPolygon(cabinX, cabinY, cabinX.length);
|
|
||||||
g.setColor(AirBomber.getBodyColor());
|
|
||||||
//отрисовка корпуса
|
|
||||||
g.fillRect(_startPosXInt + 20, _startPosYInt + 40, 90, 20);
|
|
||||||
|
|
||||||
//отрисовка правого крыла
|
|
||||||
int[] rightWingX =
|
|
||||||
{
|
|
||||||
_startPosXInt + 50,
|
|
||||||
_startPosXInt + 50,
|
|
||||||
_startPosXInt + 60,
|
|
||||||
_startPosXInt + 70
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] rightWingY =
|
|
||||||
{
|
|
||||||
_startPosYInt + 40,
|
|
||||||
_startPosYInt,
|
|
||||||
_startPosYInt,
|
|
||||||
_startPosYInt + 40
|
|
||||||
};
|
|
||||||
|
|
||||||
g.fillPolygon(rightWingX, rightWingY, rightWingX.length);
|
|
||||||
|
|
||||||
//отрисовка левого крыла
|
|
||||||
int[] leftWingX =
|
|
||||||
{
|
|
||||||
_startPosXInt + 50,
|
|
||||||
_startPosXInt + 50,
|
|
||||||
_startPosXInt + 60,
|
|
||||||
_startPosXInt + 70
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] leftWingY =
|
|
||||||
{
|
|
||||||
_startPosYInt + 60,
|
|
||||||
_startPosYInt + 100,
|
|
||||||
_startPosYInt + 100,
|
|
||||||
_startPosYInt + 60
|
|
||||||
};
|
|
||||||
|
|
||||||
g.fillPolygon(leftWingX, leftWingY, leftWingX.length);
|
|
||||||
|
|
||||||
//отрисовка хвоста (справа)
|
|
||||||
int[] rightTailX =
|
|
||||||
{
|
|
||||||
_startPosXInt + 95,
|
|
||||||
_startPosXInt + 95,
|
|
||||||
_startPosXInt + 110,
|
|
||||||
_startPosXInt + 110
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] rightTailY =
|
|
||||||
{
|
|
||||||
_startPosYInt + 40,
|
|
||||||
_startPosYInt + 30,
|
|
||||||
_startPosYInt + 15,
|
|
||||||
_startPosYInt + 40
|
|
||||||
};
|
|
||||||
|
|
||||||
g.fillPolygon(rightTailX, rightTailY, rightTailX.length);
|
|
||||||
|
|
||||||
//отрисовка хвоста (слева)
|
|
||||||
int[] leftTailX =
|
|
||||||
{
|
|
||||||
_startPosXInt + 95,
|
|
||||||
_startPosXInt + 95,
|
|
||||||
_startPosXInt + 110,
|
|
||||||
_startPosXInt + 110
|
|
||||||
};
|
|
||||||
|
|
||||||
int[] leftTailY =
|
|
||||||
{
|
|
||||||
_startPosYInt + 60,
|
|
||||||
_startPosYInt + 70,
|
|
||||||
_startPosYInt + 85,
|
|
||||||
_startPosYInt + 60
|
|
||||||
};
|
|
||||||
|
|
||||||
g.fillPolygon(leftTailX, leftTailY, leftTailX.length);
|
|
||||||
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
|
|
||||||
g.drawRect(_startPosXInt + 20, _startPosYInt + 40, 90, 20);
|
|
||||||
g.drawPolygon(rightWingX, rightWingY, rightWingX.length);
|
|
||||||
g.drawPolygon(leftWingX, leftWingY, leftWingX.length);
|
|
||||||
g.drawPolygon(rightTailX, rightTailY, rightTailX.length);
|
|
||||||
g.drawPolygon(leftTailX, leftTailY, leftTailX.length);
|
|
||||||
g.drawLine(_startPosXInt, _startPosYInt + 50, _startPosXInt + 5, _startPosYInt + 50);
|
|
||||||
}
|
|
||||||
|
|
||||||
public float [] GetCurrentPosition()
|
|
||||||
{
|
|
||||||
float[] pos = new float[4];
|
|
||||||
pos[0] = _startPosX;
|
|
||||||
pos[1] = _startPosY;
|
|
||||||
pos[2] = _startPosX + _airBomberWidth;
|
|
||||||
pos[3] = _startPosY + _airBomberHeight;
|
|
||||||
return pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEngines(IDrawingObjectDop newEngines){
|
|
||||||
drawingEngines = newEngines;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ChangeBorders(int width, int height)
|
|
||||||
{
|
|
||||||
_pictureWidth = width;
|
|
||||||
_pictureHeight = height;
|
|
||||||
if (_pictureWidth <= _airBomberWidth || _pictureHeight <= _airBomberHeight)
|
|
||||||
{
|
|
||||||
_pictureWidth = null;
|
|
||||||
_pictureHeight = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_startPosX + _airBomberWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
_startPosX = _pictureWidth - _airBomberWidth;
|
|
||||||
}
|
|
||||||
if (_startPosY + _airBomberHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
_startPosY = _pictureHeight - _airBomberHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingEngines implements IDrawingObjectDop {
|
|
||||||
private Engines engines = null;
|
|
||||||
private int numberOfEngines;
|
|
||||||
@Override
|
|
||||||
public int getNumberOfEngines() {
|
|
||||||
return numberOfEngines;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void setNumberOfEngines(int numberOfEngines) {
|
|
||||||
if (numberOfEngines != 2 && numberOfEngines != 4 && numberOfEngines != 6) return;
|
|
||||||
this.numberOfEngines = numberOfEngines;
|
|
||||||
switch (this.numberOfEngines) {
|
|
||||||
case 2:
|
|
||||||
engines = Engines.TWO;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
engines = Engines.FOUR;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
engines = Engines.SIX;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void drawEngine(Graphics2D g, int startPosX, int startPosY, int yOffset, Color bodyColor){
|
|
||||||
g.setColor(bodyColor);
|
|
||||||
g.fillRect(startPosX + 45, startPosY + 40 + yOffset, 5, 5);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
g.drawRect(startPosX + 45, startPosY + 40 + yOffset, 5, 5);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void drawEngines(Graphics2D g, int startPosX, int startPosY, Color bodyColor){
|
|
||||||
if (engines == null) return;
|
|
||||||
|
|
||||||
switch (engines) {
|
|
||||||
case SIX:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 20, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 20, bodyColor);
|
|
||||||
case FOUR:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 10, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 10, bodyColor);
|
|
||||||
case TWO:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5, bodyColor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,64 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingEnginesOval implements IDrawingObjectDop {
|
|
||||||
private Engines engines = null;
|
|
||||||
private int numberOfEngines;
|
|
||||||
@Override
|
|
||||||
public int getNumberOfEngines() {
|
|
||||||
return numberOfEngines;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNumberOfEngines(int numberOfEngines) {
|
|
||||||
if (numberOfEngines != 2 && numberOfEngines != 4 && numberOfEngines != 6) return;
|
|
||||||
this.numberOfEngines = numberOfEngines;
|
|
||||||
switch (this.numberOfEngines) {
|
|
||||||
case 2:
|
|
||||||
engines = Engines.TWO;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
engines = Engines.FOUR;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
engines = Engines.SIX;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawEngine(Graphics2D g, int startPosX, int startPosY, int yOffset, Color bodyColor) {
|
|
||||||
g.setColor(bodyColor);
|
|
||||||
g.fillOval(startPosX + 45, startPosY + 40 + yOffset, 5, 5);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
g.drawOval(startPosX + 45, startPosY + 40 + yOffset, 5, 5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawEngines(Graphics2D g, int startPosX, int startPosY, Color bodyColor) {
|
|
||||||
if (engines == null) return;
|
|
||||||
|
|
||||||
switch (engines) {
|
|
||||||
case SIX:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 20, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 20, bodyColor);
|
|
||||||
case FOUR:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 10, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 10, bodyColor);
|
|
||||||
case TWO:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5, bodyColor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,74 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Graphics2D;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingEnginesTriangle implements IDrawingObjectDop {
|
|
||||||
private Engines engines = null;
|
|
||||||
private int numberOfEngines;
|
|
||||||
@Override
|
|
||||||
public int getNumberOfEngines() {
|
|
||||||
return numberOfEngines;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setNumberOfEngines(int numberOfEngines) {
|
|
||||||
if (numberOfEngines != 2 && numberOfEngines != 4 && numberOfEngines != 6) return;
|
|
||||||
this.numberOfEngines = numberOfEngines;
|
|
||||||
switch (this.numberOfEngines) {
|
|
||||||
case 2:
|
|
||||||
engines = Engines.TWO;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
engines = Engines.FOUR;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
engines = Engines.SIX;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawEngine(Graphics2D g, int startPosX, int startPosY, int yOffset, Color bodyColor) {
|
|
||||||
g.setColor(bodyColor);
|
|
||||||
int[] engineX = {
|
|
||||||
startPosX + 45,
|
|
||||||
startPosX + 50,
|
|
||||||
startPosX + 50,
|
|
||||||
};
|
|
||||||
int[] engineY = {
|
|
||||||
startPosY + 42 + yOffset,
|
|
||||||
startPosY + 38 + yOffset,
|
|
||||||
startPosY + 46 + yOffset,
|
|
||||||
};
|
|
||||||
g.fillPolygon(engineX, engineY, engineX.length);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
g.drawPolygon(engineX, engineY, engineX.length);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawEngines(Graphics2D g, int startPosX, int startPosY, Color bodyColor) {
|
|
||||||
if (engines == null) return;
|
|
||||||
|
|
||||||
switch (engines) {
|
|
||||||
case SIX:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 20, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 20, bodyColor);
|
|
||||||
case FOUR:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5 - 10, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5 + 10, bodyColor);
|
|
||||||
case TWO:
|
|
||||||
drawEngine(g, startPosX, startPosY, -5 - 5, bodyColor);
|
|
||||||
drawEngine(g, startPosX, startPosY, 20 + 5, bodyColor);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingHeavyAirBomber extends DrawingAirBomber {
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
|
||||||
/// <param name="bodyColor">Цвет кузова</param>
|
|
||||||
/// <param name="dopColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="bodyKit">Признак наличия обвеса</param>
|
|
||||||
/// <param name="wing">Признак наличия антикрыла</param>
|
|
||||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
|
||||||
public DrawingHeavyAirBomber(int speed, float weight, Color bodyColor, int numberOfEngines, EnginesType enginesType, Color dopColor, boolean bodyKit, boolean wing, boolean sportLine)
|
|
||||||
{
|
|
||||||
super(speed, weight, bodyColor, numberOfEngines, enginesType, 110, 100);
|
|
||||||
AirBomber = new EntityHeavyAirBomber(speed, weight, bodyColor, dopColor, bodyKit, wing, sportLine);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void DrawTransport(Graphics2D g)
|
|
||||||
{
|
|
||||||
if (!(AirBomber instanceof EntityHeavyAirBomber heavyAirBomber))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (heavyAirBomber.getBombs())
|
|
||||||
{
|
|
||||||
g.setColor(heavyAirBomber.getDopColor());
|
|
||||||
g.fillOval(_startPosX + 45, _startPosY, 20, 10);
|
|
||||||
g.fillOval(_startPosX + 45, _startPosY + 90, 20, 10);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
g.drawOval(_startPosX + 45, _startPosY, 20, 10);
|
|
||||||
g.drawOval(_startPosX + 45, _startPosY + 90, 20, 10);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
super.DrawTransport(g);
|
|
||||||
|
|
||||||
if (heavyAirBomber.getTailLine())
|
|
||||||
{
|
|
||||||
g.setColor(heavyAirBomber.getDopColor());
|
|
||||||
g.fillRect(_startPosX + 95, _startPosY + 30, 15, 5);
|
|
||||||
g.fillRect(_startPosX + 95, _startPosY + 65, 15, 5);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (heavyAirBomber.getFuelTank())
|
|
||||||
{
|
|
||||||
g.setColor(heavyAirBomber.getDopColor());
|
|
||||||
g.fillOval(_startPosX + 23, _startPosY + 42, 25, 15);
|
|
||||||
g.fillOval(_startPosX + 53, _startPosY + 42, 25, 15);
|
|
||||||
g.fillOval(_startPosX + 83, _startPosY + 42, 25, 15);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
g.drawOval(_startPosX + 23, _startPosY + 42, 25, 15);
|
|
||||||
g.drawOval(_startPosX + 53, _startPosY + 42, 25, 15);
|
|
||||||
g.drawOval(_startPosX + 83, _startPosY + 42, 25, 15);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,70 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class DrawingObjectAirBomber implements IDrawingObject {
|
|
||||||
private DrawingAirBomber _airBomber = null;
|
|
||||||
|
|
||||||
public DrawingObjectAirBomber(DrawingAirBomber airBomber)
|
|
||||||
{
|
|
||||||
_airBomber = airBomber;
|
|
||||||
Step = _airBomber.AirBomber.Step;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float Step;
|
|
||||||
@Override
|
|
||||||
public float getStep(){
|
|
||||||
return Step;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public float[] GetCurrentPosition()
|
|
||||||
{
|
|
||||||
if (_airBomber == null) return null;
|
|
||||||
return _airBomber.GetCurrentPosition();
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void MoveObject(Direction direction)
|
|
||||||
{
|
|
||||||
_airBomber.MoveTransport(direction);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void SetObject(int x, int y, int width, int height)
|
|
||||||
{
|
|
||||||
_airBomber.SetPosition(x, y, width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingAirBomber getAirBomber(){
|
|
||||||
return _airBomber;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void DrawingObject(Graphics2D g)
|
|
||||||
{
|
|
||||||
if (_airBomber == null) return;
|
|
||||||
if (_airBomber instanceof DrawingHeavyAirBomber heavyAirBomber)
|
|
||||||
{
|
|
||||||
heavyAirBomber.DrawTransport(g);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_airBomber.DrawTransport(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String GetInfo() {
|
|
||||||
if (_airBomber != null) return ExtentionAirBomber.ExtentionedAirBomber.GetDataForSave(_airBomber);
|
|
||||||
else return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IDrawingObject Create(String data){
|
|
||||||
return new DrawingObjectAirBomber(ExtentionAirBomber.ExtentionedAirBomber.CreateDrawningAirBomber(data));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public enum Engines {
|
|
||||||
TWO,
|
|
||||||
FOUR,
|
|
||||||
SIX
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public enum EnginesType {
|
|
||||||
RECTANGLE,
|
|
||||||
TRIANGLE,
|
|
||||||
OVAL
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class EntityAirBomber {
|
|
||||||
private int Speed;
|
|
||||||
|
|
||||||
private float Weight;
|
|
||||||
|
|
||||||
private Color BodyColor;
|
|
||||||
|
|
||||||
public float Step;
|
|
||||||
|
|
||||||
public int getSpeed() {
|
|
||||||
return Speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getWeight() {
|
|
||||||
return Weight;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Color getBodyColor() {
|
|
||||||
return BodyColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBodyColor(Color newColor){
|
|
||||||
BodyColor = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public EntityAirBomber(int speed, float weight, Color bodyColor){
|
|
||||||
Random rnd = new Random();
|
|
||||||
Speed = speed <= 0 ? rnd.nextInt(50, 150) : speed;
|
|
||||||
Weight = weight <= 0 ? rnd.nextInt(40, 70) : weight;
|
|
||||||
Step = Speed * 100 / Weight;
|
|
||||||
BodyColor = bodyColor;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class EntityHeavyAirBomber extends EntityAirBomber {
|
|
||||||
/// <summary>
|
|
||||||
/// Дополнительный цвет
|
|
||||||
/// </summary>
|
|
||||||
private Color DopColor;
|
|
||||||
/// <summary>
|
|
||||||
/// Признак наличия бомб
|
|
||||||
/// </summary>
|
|
||||||
private boolean bombs;
|
|
||||||
/// <summary>
|
|
||||||
/// Признак наличия топливных баков
|
|
||||||
/// </summary>
|
|
||||||
private boolean fuelTank;
|
|
||||||
/// <summary>
|
|
||||||
/// Признак наличия полосы на хвосте
|
|
||||||
/// </summary>
|
|
||||||
private boolean tailLine;
|
|
||||||
|
|
||||||
public Color getDopColor() {
|
|
||||||
return DopColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getBombs(){
|
|
||||||
return bombs;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getFuelTank(){
|
|
||||||
return fuelTank;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean getTailLine(){
|
|
||||||
return tailLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDopColor(Color newColor){
|
|
||||||
DopColor = newColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Инициализация свойств
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="speed">Скорость</param>
|
|
||||||
/// <param name="weight">Вес бомбардировщика</param>
|
|
||||||
/// <param name="bodyColor">Цвет корпуса</param>
|
|
||||||
/// <param name="dopColor">Дополнительный цвет</param>
|
|
||||||
/// <param name="bombs">Признак наличия обвеса</param>
|
|
||||||
/// <param name="fuelTank">Признак наличия антикрыла</param>
|
|
||||||
/// <param name="tailLine">Признак наличия гоночной полосы</param>
|
|
||||||
public EntityHeavyAirBomber(int speed, float weight, Color bodyColor, Color dopColor, boolean bombs, boolean fuelTank, boolean tailLine)
|
|
||||||
{
|
|
||||||
super(speed, weight, bodyColor);
|
|
||||||
DopColor = dopColor;
|
|
||||||
this.bombs = bombs;
|
|
||||||
this.fuelTank = fuelTank;
|
|
||||||
this.tailLine = tailLine;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class ExtentionAirBomber{
|
|
||||||
public static class ExtentionedAirBomber {
|
|
||||||
/// <summary>
|
|
||||||
/// Разделитель для записи информации по объекту в файл
|
|
||||||
/// </summary>
|
|
||||||
private static String _separatorForObject = ":";
|
|
||||||
/// <summary>
|
|
||||||
/// Создание объекта из строки
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="info"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static DrawingAirBomber CreateDrawningAirBomber(String info)
|
|
||||||
{
|
|
||||||
String[] strs = info.split(_separatorForObject);
|
|
||||||
if (strs.length == 7) //заменить на передачу RGB
|
|
||||||
{
|
|
||||||
EnginesType enginesType = null;
|
|
||||||
switch (strs[6]) {
|
|
||||||
case "DrawingEngines":
|
|
||||||
enginesType = EnginesType.RECTANGLE;
|
|
||||||
break;
|
|
||||||
case "DrawingEnginesTriangle":
|
|
||||||
enginesType = EnginesType.TRIANGLE;
|
|
||||||
break;
|
|
||||||
case "DrawingEnginesOval":
|
|
||||||
enginesType = EnginesType.OVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new DrawingAirBomber(Integer.parseInt(strs[0]),
|
|
||||||
Integer.parseInt(strs[1]), new Color(Integer.parseInt(strs[2]), Integer.parseInt(strs[3]), Integer.parseInt(strs[4])), Integer.parseInt(strs[5]), enginesType);
|
|
||||||
}
|
|
||||||
if (strs.length == 13)
|
|
||||||
{
|
|
||||||
EnginesType enginesType = null;
|
|
||||||
switch (strs[6]) {
|
|
||||||
case "DrawingEngines":
|
|
||||||
enginesType = EnginesType.RECTANGLE;
|
|
||||||
break;
|
|
||||||
case "DrawingEnginesTriangle":
|
|
||||||
enginesType = EnginesType.TRIANGLE;
|
|
||||||
break;
|
|
||||||
case "DrawingEnginesOval":
|
|
||||||
enginesType = EnginesType.OVAL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return new DrawingHeavyAirBomber(Integer.parseInt(strs[0]), Float.parseFloat(strs[1]),
|
|
||||||
new Color(Integer.parseInt(strs[2]), Integer.parseInt(strs[3]),Integer.parseInt(strs[4])),
|
|
||||||
Integer.parseInt(strs[5]), enginesType,
|
|
||||||
new Color(Integer.parseInt(strs[7]), Integer.parseInt(strs[8]), Integer.parseInt(strs[9])),
|
|
||||||
Boolean.parseBoolean(strs[10]),Boolean.parseBoolean(strs[11]), Boolean.parseBoolean(strs[12]));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public static String GetDataForSave(DrawingAirBomber drawningAirBomber)
|
|
||||||
{
|
|
||||||
var airBomber = drawningAirBomber.AirBomber;
|
|
||||||
var str = String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s", airBomber.getSpeed(), _separatorForObject, Math.round(airBomber.getWeight()), _separatorForObject, airBomber.getBodyColor().getRed(), _separatorForObject, airBomber.getBodyColor().getGreen(), _separatorForObject, airBomber.getBodyColor().getBlue(), _separatorForObject, drawningAirBomber.drawingEngines.getNumberOfEngines(), _separatorForObject, drawningAirBomber.drawingEngines.getClass().getSimpleName());
|
|
||||||
if (airBomber instanceof EntityHeavyAirBomber heavyAirBomber)
|
|
||||||
{
|
|
||||||
return String.format("%s%s%s%s%s%s%s%s%s%s%s%s%s", str,_separatorForObject,heavyAirBomber.getDopColor().getRed(),_separatorForObject, heavyAirBomber.getDopColor().getGreen(), _separatorForObject, heavyAirBomber.getDopColor().getBlue(), _separatorForObject, heavyAirBomber.getBombs(), _separatorForObject, heavyAirBomber.getFuelTank(), _separatorForObject, heavyAirBomber.getTailLine());
|
|
||||||
}
|
|
||||||
else return str;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public interface IDrawingObject {
|
|
||||||
/// <summary>
|
|
||||||
/// Шаг перемещения объекта
|
|
||||||
/// </summary>
|
|
||||||
public float getStep();
|
|
||||||
/// <summary>
|
|
||||||
/// Установка позиции объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="x">Координата X</param>
|
|
||||||
/// <param name="y">Координата Y</param>
|
|
||||||
/// <param name="width">Ширина полотна</param>
|
|
||||||
/// <param name="height">Высота полотна</param>
|
|
||||||
void SetObject(int x, int y, int width, int height);
|
|
||||||
/// <summary>
|
|
||||||
/// Изменение направления пермещения объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="direction">Направление</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
void MoveObject(Direction direction);
|
|
||||||
/// <summary>
|
|
||||||
/// Отрисовка объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="g"></param>
|
|
||||||
void DrawingObject(Graphics2D g);
|
|
||||||
/// <summary>
|
|
||||||
/// Получение текущей позиции объекта
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
float[] GetCurrentPosition();
|
|
||||||
|
|
||||||
String GetInfo();
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public interface IDrawingObjectDop {
|
|
||||||
public int getNumberOfEngines();
|
|
||||||
void setNumberOfEngines(int numberOfEngines);
|
|
||||||
void drawEngine(Graphics2D g, int startPosX, int startPosY, int yOffset, Color bodyColor);
|
|
||||||
void drawEngines(Graphics2D g, int startPosX, int startPosY, Color bodyColor);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public interface ITransferAirBomberDelegate {
|
|
||||||
public void Invoke(DrawingAirBomber airBomber);
|
|
||||||
}
|
|
@ -1,15 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
|
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="defaultCloseOperation" type="int" value="2"/>
|
<Property name="defaultCloseOperation" type="int" value="3"/>
|
||||||
<Property name="title" type="java.lang.String" value="Бомбардировщик"/>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
|
||||||
<Font name="Arial" size="10" style="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="size" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[700, 400]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
</Properties>
|
||||||
<SyntheticProperties>
|
<SyntheticProperties>
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
||||||
@ -30,250 +23,13 @@
|
|||||||
<Layout>
|
<Layout>
|
||||||
<DimensionLayout dim="0">
|
<DimensionLayout dim="0">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="statusLabel" alignment="0" max="32767" attributes="0"/>
|
<EmptySpace min="0" pref="400" max="32767" attributes="0"/>
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEngines" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEnginesType" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="createAirBomberButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="ModifyButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonSelect" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="157" max="32767" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="upButton" alignment="1" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="leftButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
<DimensionLayout dim="1">
|
<DimensionLayout dim="1">
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Group type="102" alignment="1" attributes="0">
|
<EmptySpace min="0" pref="300" max="32767" attributes="0"/>
|
||||||
<Component id="airBomberCanvas" pref="298" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabelEngines" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEngines" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines1" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEnginesType" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
|
||||||
<Component id="createAirBomberButton" max="32767" attributes="0"/>
|
|
||||||
<Component id="buttonSelect" alignment="0" pref="31" max="32767" attributes="0"/>
|
|
||||||
<Component id="ModifyButton" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="upButton" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="leftButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="statusLabel" min="-2" pref="22" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
</Layout>
|
</Layout>
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JButton" name="createAirBomberButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Создать"/>
|
|
||||||
<Property name="name" type="java.lang.String" value="createAirBomberButton" noResource="true"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createAirBomberButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="leftButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowLeft.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
|
||||||
<Insets value="[0, 0, 0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonLeft" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="downButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowDown.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonDown" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="rightButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowRight.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonRight" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="upButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowUp.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonUp" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="statusLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Скорость: Вес: Цвет: Двигатели:"/>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Container class="AirBomberPackage.CanvasMy" name="airBomberCanvas">
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="componentResized" listener="java.awt.event.ComponentListener" parameters="java.awt.event.ComponentEvent" handler="airBomberCanvasComponentResized"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelEngines">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Количество двигателей: "/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JComboBox" name="jComboBoxEngines">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="3">
|
|
||||||
<StringItem index="0" value="Два"/>
|
|
||||||
<StringItem index="1" value="Четыре"/>
|
|
||||||
<StringItem index="2" value="Шесть"/>
|
|
||||||
</StringArray>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="ModifyButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Модификация"/>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
|
||||||
<Property name="name" type="java.lang.String" value="modifyButton" noResource="true"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ModifyButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelEngines1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Тип двигателей: "/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JComboBox" name="jComboBoxEnginesType">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="3">
|
|
||||||
<StringItem index="0" value="Квадратный"/>
|
|
||||||
<StringItem index="1" value="Треугольный"/>
|
|
||||||
<StringItem index="2" value="Круглый"/>
|
|
||||||
</StringArray>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jComboBoxEnginesTypeItemStateChanged"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonSelect">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Выбрать"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonSelectActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
</Form>
|
||||||
|
@ -3,36 +3,20 @@
|
|||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||||
*/
|
*/
|
||||||
package AirBomberPackage;
|
package AirBomberPackage;
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Андрей
|
* @author Андрей
|
||||||
*/
|
*/
|
||||||
public class JFrameAirBomber extends javax.swing.JDialog {
|
public class JFrameAirBomber extends javax.swing.JFrame {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form JFrameAirBomber
|
* Creates new form JFrameAirBomber
|
||||||
*/
|
*/
|
||||||
public JFrameAirBomber(JFrame parent) {
|
public JFrameAirBomber() {
|
||||||
super(parent, "Бомбардировщик", true);
|
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public JFrameAirBomber(JFrame parent, DrawingObjectAirBomber airBomber) {
|
|
||||||
super(parent, "Бомбардировщик", true);
|
|
||||||
initComponents();
|
|
||||||
_airBomber = airBomber.getAirBomber();
|
|
||||||
SetData();
|
|
||||||
Draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
private DrawingAirBomber _airBomber;
|
|
||||||
private EnginesType enginesType = EnginesType.RECTANGLE;
|
|
||||||
private DrawingAirBomber _airBomberResult;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is called from within the constructor to initialize the form.
|
* 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
|
* WARNING: Do NOT modify this code. The content of this method is always
|
||||||
@ -42,268 +26,22 @@ public class JFrameAirBomber extends javax.swing.JDialog {
|
|||||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
createAirBomberButton = new javax.swing.JButton();
|
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
||||||
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<>();
|
|
||||||
ModifyButton = new javax.swing.JButton();
|
|
||||||
jLabelEngines1 = new javax.swing.JLabel();
|
|
||||||
jComboBoxEnginesType = new javax.swing.JComboBox<>();
|
|
||||||
buttonSelect = new javax.swing.JButton();
|
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
|
||||||
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[] { "Два", "Четыре", "Шесть" }));
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonSelect.setText("Выбрать");
|
|
||||||
buttonSelect.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonSelectActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(statusLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addGap(0, 400, 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)
|
|
||||||
.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)
|
|
||||||
.addComponent(ModifyButton)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.addComponent(buttonSelect)))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 157, Short.MAX_VALUE)
|
|
||||||
.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))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
);
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
.addGap(0, 300, Short.MAX_VALUE)
|
||||||
.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)
|
|
||||||
.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))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
||||||
.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)
|
|
||||||
.addComponent(ModifyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
|
|
||||||
.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))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
pack();
|
pack();
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
private void createAirBomberButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createAirBomberButtonActionPerformed
|
|
||||||
Random rnd = new Random();
|
|
||||||
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();
|
|
||||||
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
|
|
||||||
|
|
||||||
private void ModifyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModifyButtonActionPerformed
|
|
||||||
Random rnd = new Random();
|
|
||||||
Color chosenColor = JColorChooser.showDialog(this, "Вибирете цвет", Color.BLACK);
|
|
||||||
Color chosenDopColor = JColorChooser.showDialog(this, "Вибирете цвет", Color.BLACK);
|
|
||||||
_airBomber = new DrawingHeavyAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
|
||||||
chosenColor,
|
|
||||||
(jComboBoxEngines.getSelectedIndex() + 1) * 2,
|
|
||||||
enginesType,
|
|
||||||
chosenDopColor,
|
|
||||||
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
|
|
||||||
|
|
||||||
private void buttonSelectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonSelectActionPerformed
|
|
||||||
_airBomberResult = _airBomber;
|
|
||||||
dispose();
|
|
||||||
}//GEN-LAST:event_buttonSelectActionPerformed
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw(){
|
|
||||||
airBomberCanvas.repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DrawingAirBomber run(){
|
|
||||||
setVisible(true);
|
|
||||||
return _airBomberResult;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param args the command line arguments
|
* @param args the command line arguments
|
||||||
*/
|
*/
|
||||||
@ -334,24 +72,11 @@ public class JFrameAirBomber extends javax.swing.JDialog {
|
|||||||
/* Create and display the form */
|
/* Create and display the form */
|
||||||
java.awt.EventQueue.invokeLater(new Runnable() {
|
java.awt.EventQueue.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
new JFrameMapWithSetAirBombers().setVisible(true);
|
new JFrameAirBomber().setVisible(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||||
private javax.swing.JButton ModifyButton;
|
|
||||||
private AirBomberPackage.CanvasMy airBomberCanvas;
|
|
||||||
private javax.swing.JButton buttonSelect;
|
|
||||||
private javax.swing.JButton createAirBomberButton;
|
|
||||||
private javax.swing.JButton downButton;
|
|
||||||
private javax.swing.JComboBox<String> jComboBoxEngines;
|
|
||||||
private javax.swing.JComboBox<String> jComboBoxEnginesType;
|
|
||||||
private javax.swing.JLabel jLabelEngines;
|
|
||||||
private javax.swing.JLabel jLabelEngines1;
|
|
||||||
private javax.swing.JButton leftButton;
|
|
||||||
private javax.swing.JButton rightButton;
|
|
||||||
private javax.swing.JLabel statusLabel;
|
|
||||||
private javax.swing.JButton upButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
}
|
}
|
||||||
|
@ -1,589 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
|
||||||
<Properties>
|
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
|
||||||
<Property name="title" type="java.lang.String" value="Создание объекта"/>
|
|
||||||
</Properties>
|
|
||||||
<SyntheticProperties>
|
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
|
||||||
</SyntheticProperties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jCheckBoxBombs" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jCheckBoxFuelTanks" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jCheckBoxTailLine" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="44" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
|
||||||
<Component id="jSpinnerWeight" pref="79" max="32767" attributes="0"/>
|
|
||||||
<Component id="jSpinnerSpeed" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jLabel5" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="jSpinnerNumOfEngines" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jLabelRect" min="-2" pref="102" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelTriangle" min="-2" pref="102" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="jLabelRound" min="-2" pref="102" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="121" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="1" max="-2" attributes="0">
|
|
||||||
<Component id="jLabel4" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="jPanelWhite" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="jPanelRed" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jPanelGreen" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelBlue" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelYellow" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jPanelGray" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelBlack" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelPurple" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jLabelSimpleObject" min="-2" pref="90" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelModifiedObject" min="-2" pref="90" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="96" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="jButtonOk" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jButtonCancel" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="canvasMyObject" min="-2" pref="166" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="jLabelBaseColor" min="-2" pref="80" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelDopColor" min="-2" pref="72" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="20" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jSpinnerSpeed" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jSpinnerWeight" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelBaseColor" alignment="3" min="-2" pref="35" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelDopColor" alignment="3" min="-2" pref="35" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jSpinnerNumOfEngines" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="jPanelGray" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="jPanelYellow" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelRed" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelGreen" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelBlue" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabelRect" alignment="3" min="-2" pref="37" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelTriangle" alignment="3" min="-2" pref="37" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="103" alignment="1" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="jPanelWhite" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jPanelBlack" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jPanelPurple" alignment="1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelRound" min="-2" pref="37" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="11" max="32767" attributes="0"/>
|
|
||||||
<Component id="jCheckBoxBombs" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="canvasMyObject" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="jCheckBoxFuelTanks" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jCheckBoxTailLine" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jLabelSimpleObject" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="jButtonOk" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="jLabelModifiedObject" alignment="1" max="32767" attributes="0"/>
|
|
||||||
<Component id="jButtonCancel" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Параметры"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Скорость:"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JSpinner" name="jSpinnerSpeed">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
|
||||||
<SpinnerModel initial="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel3">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Вес:"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JSpinner" name="jSpinnerWeight">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
|
||||||
<SpinnerModel initial="100" minimum="1" numberType="java.lang.Integer" stepSize="1" type="number"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JCheckBox" name="jCheckBoxFuelTanks">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Признак наличия топливных баков"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JCheckBox" name="jCheckBoxBombs">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Признак наличия бомб"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JCheckBox" name="jCheckBoxTailLine">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Признак наличия полосок на хвосте"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelSimpleObject">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Простой"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelObjectMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelModifiedObject">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Продвинутый"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelObjectMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelGreen">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="66" green="ff" red="66" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelWhite">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="ff" green="ff" red="ff" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelRed">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="33" green="0" red="ff" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelGray">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="99" green="99" red="99" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelBlue">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="ff" green="33" red="33" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelBlack">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="0" green="0" red="0" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelYellow">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="33" green="ff" red="ff" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Container class="javax.swing.JPanel" name="jPanelPurple">
|
|
||||||
<Properties>
|
|
||||||
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
|
|
||||||
<Color blue="ff" green="33" red="cc" type="rgb"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jPanelColorMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel4">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Цвета"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel5">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Количество двигателей:"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JSpinner" name="jSpinnerNumOfEngines">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.SpinnerModel" editor="org.netbeans.modules.form.editors2.SpinnerModelEditor">
|
|
||||||
<SpinnerModel type="list">
|
|
||||||
<ListItem value="2"/>
|
|
||||||
<ListItem value="4"/>
|
|
||||||
<ListItem value="6"/>
|
|
||||||
</SpinnerModel>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelRect">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Квадратные"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelTriangle">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Треугольные"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelRound">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Круглые"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineMousePressed"/>
|
|
||||||
<EventHandler event="mouseReleased" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelEngineTypeMouseReleased"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="AirBomberPackage.CanvasMy" name="canvasMyObject">
|
|
||||||
<Properties>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
|
|
||||||
<LineBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="canvasMyObjectMouseEntered"/>
|
|
||||||
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="canvasMyObjectMouseExited"/>
|
|
||||||
</Events>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelBaseColor">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Цвет"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelBaseColorMouseEntered"/>
|
|
||||||
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelBaseColorMouseExited"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelDopColor">
|
|
||||||
<Properties>
|
|
||||||
<Property name="horizontalAlignment" type="int" value="0"/>
|
|
||||||
<Property name="text" type="java.lang.String" value="Доп. Цвет"/>
|
|
||||||
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
|
|
||||||
<Border info="org.netbeans.modules.form.compat2.border.SoftBevelBorderInfo">
|
|
||||||
<BevelBorder/>
|
|
||||||
</Border>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="mouseEntered" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelDopColorMouseEntered"/>
|
|
||||||
<EventHandler event="mouseExited" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jLabelDopColorMouseExited"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="jButtonOk">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Добавить"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonOkActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="jButtonCancel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Отмена"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,672 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class JFrameAirBomberConfig extends javax.swing.JFrame {
|
|
||||||
|
|
||||||
private IDrawingObjectDop engines;
|
|
||||||
private Color dragColor;
|
|
||||||
private String typeOfAirBomber;
|
|
||||||
private DrawingAirBomber _airBomber = null;
|
|
||||||
private boolean cursorInCanvasLocation = false;
|
|
||||||
private boolean cursorInBaseLabelLocation = false;
|
|
||||||
private boolean cursorInDopLabelLocation = false;
|
|
||||||
private ArrayList<ITransferAirBomberDelegate> eventAddAirBomber = new ArrayList<>();
|
|
||||||
/**
|
|
||||||
* Creates new form JFrameAirBomberConfig
|
|
||||||
*/
|
|
||||||
public JFrameAirBomberConfig() {
|
|
||||||
initComponents();
|
|
||||||
jButtonCancel.addActionListener(e -> dispose());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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() {
|
|
||||||
|
|
||||||
jLabel1 = new javax.swing.JLabel();
|
|
||||||
jLabel2 = new javax.swing.JLabel();
|
|
||||||
jSpinnerSpeed = new javax.swing.JSpinner();
|
|
||||||
jLabel3 = new javax.swing.JLabel();
|
|
||||||
jSpinnerWeight = new javax.swing.JSpinner();
|
|
||||||
jCheckBoxFuelTanks = new javax.swing.JCheckBox();
|
|
||||||
jCheckBoxBombs = new javax.swing.JCheckBox();
|
|
||||||
jCheckBoxTailLine = new javax.swing.JCheckBox();
|
|
||||||
jLabelSimpleObject = new javax.swing.JLabel();
|
|
||||||
jLabelModifiedObject = new javax.swing.JLabel();
|
|
||||||
jPanelGreen = new javax.swing.JPanel();
|
|
||||||
jPanelWhite = new javax.swing.JPanel();
|
|
||||||
jPanelRed = new javax.swing.JPanel();
|
|
||||||
jPanelGray = new javax.swing.JPanel();
|
|
||||||
jPanelBlue = new javax.swing.JPanel();
|
|
||||||
jPanelBlack = new javax.swing.JPanel();
|
|
||||||
jPanelYellow = new javax.swing.JPanel();
|
|
||||||
jPanelPurple = new javax.swing.JPanel();
|
|
||||||
jLabel4 = new javax.swing.JLabel();
|
|
||||||
jLabel5 = new javax.swing.JLabel();
|
|
||||||
jSpinnerNumOfEngines = new javax.swing.JSpinner();
|
|
||||||
jLabelRect = new javax.swing.JLabel();
|
|
||||||
jLabelTriangle = new javax.swing.JLabel();
|
|
||||||
jLabelRound = new javax.swing.JLabel();
|
|
||||||
canvasMyObject = new AirBomberPackage.CanvasMy();
|
|
||||||
jLabelBaseColor = new javax.swing.JLabel();
|
|
||||||
jLabelDopColor = new javax.swing.JLabel();
|
|
||||||
jButtonOk = new javax.swing.JButton();
|
|
||||||
jButtonCancel = new javax.swing.JButton();
|
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
setTitle("Создание объекта");
|
|
||||||
|
|
||||||
jLabel1.setText("Параметры");
|
|
||||||
|
|
||||||
jLabel2.setText("Скорость:");
|
|
||||||
|
|
||||||
jSpinnerSpeed.setModel(new javax.swing.SpinnerNumberModel(100, 1, null, 1));
|
|
||||||
|
|
||||||
jLabel3.setText("Вес:");
|
|
||||||
|
|
||||||
jSpinnerWeight.setModel(new javax.swing.SpinnerNumberModel(100, 1, null, 1));
|
|
||||||
|
|
||||||
jCheckBoxFuelTanks.setText("Признак наличия топливных баков");
|
|
||||||
|
|
||||||
jCheckBoxBombs.setText("Признак наличия бомб");
|
|
||||||
|
|
||||||
jCheckBoxTailLine.setText("Признак наличия полосок на хвосте");
|
|
||||||
|
|
||||||
jLabelSimpleObject.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelSimpleObject.setText("Простой");
|
|
||||||
jLabelSimpleObject.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelSimpleObject.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelObjectMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelModifiedObject.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelModifiedObject.setText("Продвинутый");
|
|
||||||
jLabelModifiedObject.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelModifiedObject.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelObjectMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jPanelGreen.setBackground(new java.awt.Color(102, 255, 102));
|
|
||||||
jPanelGreen.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelGreenLayout = new javax.swing.GroupLayout(jPanelGreen);
|
|
||||||
jPanelGreen.setLayout(jPanelGreenLayout);
|
|
||||||
jPanelGreenLayout.setHorizontalGroup(
|
|
||||||
jPanelGreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelGreenLayout.setVerticalGroup(
|
|
||||||
jPanelGreenLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelWhite.setBackground(new java.awt.Color(255, 255, 255));
|
|
||||||
jPanelWhite.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelWhiteLayout = new javax.swing.GroupLayout(jPanelWhite);
|
|
||||||
jPanelWhite.setLayout(jPanelWhiteLayout);
|
|
||||||
jPanelWhiteLayout.setHorizontalGroup(
|
|
||||||
jPanelWhiteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelWhiteLayout.setVerticalGroup(
|
|
||||||
jPanelWhiteLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelRed.setBackground(new java.awt.Color(255, 0, 51));
|
|
||||||
jPanelRed.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelRedLayout = new javax.swing.GroupLayout(jPanelRed);
|
|
||||||
jPanelRed.setLayout(jPanelRedLayout);
|
|
||||||
jPanelRedLayout.setHorizontalGroup(
|
|
||||||
jPanelRedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelRedLayout.setVerticalGroup(
|
|
||||||
jPanelRedLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelGray.setBackground(new java.awt.Color(153, 153, 153));
|
|
||||||
jPanelGray.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelGrayLayout = new javax.swing.GroupLayout(jPanelGray);
|
|
||||||
jPanelGray.setLayout(jPanelGrayLayout);
|
|
||||||
jPanelGrayLayout.setHorizontalGroup(
|
|
||||||
jPanelGrayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelGrayLayout.setVerticalGroup(
|
|
||||||
jPanelGrayLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelBlue.setBackground(new java.awt.Color(51, 51, 255));
|
|
||||||
jPanelBlue.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelBlueLayout = new javax.swing.GroupLayout(jPanelBlue);
|
|
||||||
jPanelBlue.setLayout(jPanelBlueLayout);
|
|
||||||
jPanelBlueLayout.setHorizontalGroup(
|
|
||||||
jPanelBlueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelBlueLayout.setVerticalGroup(
|
|
||||||
jPanelBlueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelBlack.setBackground(new java.awt.Color(0, 0, 0));
|
|
||||||
jPanelBlack.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelBlackLayout = new javax.swing.GroupLayout(jPanelBlack);
|
|
||||||
jPanelBlack.setLayout(jPanelBlackLayout);
|
|
||||||
jPanelBlackLayout.setHorizontalGroup(
|
|
||||||
jPanelBlackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelBlackLayout.setVerticalGroup(
|
|
||||||
jPanelBlackLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelYellow.setBackground(new java.awt.Color(255, 255, 51));
|
|
||||||
jPanelYellow.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelYellowLayout = new javax.swing.GroupLayout(jPanelYellow);
|
|
||||||
jPanelYellow.setLayout(jPanelYellowLayout);
|
|
||||||
jPanelYellowLayout.setHorizontalGroup(
|
|
||||||
jPanelYellowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelYellowLayout.setVerticalGroup(
|
|
||||||
jPanelYellowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jPanelPurple.setBackground(new java.awt.Color(204, 51, 255));
|
|
||||||
jPanelPurple.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jPanelColorMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout jPanelPurpleLayout = new javax.swing.GroupLayout(jPanelPurple);
|
|
||||||
jPanelPurple.setLayout(jPanelPurpleLayout);
|
|
||||||
jPanelPurpleLayout.setHorizontalGroup(
|
|
||||||
jPanelPurpleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
jPanelPurpleLayout.setVerticalGroup(
|
|
||||||
jPanelPurpleLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGap(0, 40, Short.MAX_VALUE)
|
|
||||||
);
|
|
||||||
|
|
||||||
jLabel4.setText("Цвета");
|
|
||||||
|
|
||||||
jLabel5.setText("Количество двигателей:");
|
|
||||||
|
|
||||||
jSpinnerNumOfEngines.setModel(new javax.swing.SpinnerListModel(new String[] {"2", "4", "6"}));
|
|
||||||
|
|
||||||
jLabelRect.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelRect.setText("Квадратные");
|
|
||||||
jLabelRect.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelRect.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineTypeMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelTriangle.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelTriangle.setText("Треугольные");
|
|
||||||
jLabelTriangle.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelTriangle.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineTypeMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelRound.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelRound.setText("Круглые");
|
|
||||||
jLabelRound.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelRound.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mousePressed(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineMousePressed(evt);
|
|
||||||
}
|
|
||||||
public void mouseReleased(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelEngineTypeMouseReleased(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
canvasMyObject.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
|
|
||||||
canvasMyObject.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mouseEntered(java.awt.event.MouseEvent evt) {
|
|
||||||
canvasMyObjectMouseEntered(evt);
|
|
||||||
}
|
|
||||||
public void mouseExited(java.awt.event.MouseEvent evt) {
|
|
||||||
canvasMyObjectMouseExited(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelBaseColor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelBaseColor.setText("Цвет");
|
|
||||||
jLabelBaseColor.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelBaseColor.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mouseEntered(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelBaseColorMouseEntered(evt);
|
|
||||||
}
|
|
||||||
public void mouseExited(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelBaseColorMouseExited(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelDopColor.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
|
|
||||||
jLabelDopColor.setText("Доп. Цвет");
|
|
||||||
jLabelDopColor.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
|
|
||||||
jLabelDopColor.addMouseListener(new java.awt.event.MouseAdapter() {
|
|
||||||
public void mouseEntered(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelDopColorMouseEntered(evt);
|
|
||||||
}
|
|
||||||
public void mouseExited(java.awt.event.MouseEvent evt) {
|
|
||||||
jLabelDopColorMouseExited(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jButtonOk.setText("Добавить");
|
|
||||||
jButtonOk.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jButtonOkActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jButtonCancel.setText("Отмена");
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addComponent(jCheckBoxBombs)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(jCheckBoxFuelTanks)
|
|
||||||
.addComponent(jCheckBoxTailLine)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabel3)
|
|
||||||
.addGap(44, 44, 44)))
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
|
||||||
.addComponent(jSpinnerWeight, javax.swing.GroupLayout.DEFAULT_SIZE, 79, Short.MAX_VALUE)
|
|
||||||
.addComponent(jSpinnerSpeed)))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabel5)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(jSpinnerNumOfEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabelRect, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jLabelTriangle, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addGap(49, 49, 49))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabelRound, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGap(121, 121, 121)))
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
|
|
||||||
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jPanelWhite, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jPanelRed, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jPanelGreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jPanelBlue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jPanelYellow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jPanelGray, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jPanelBlack, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jPanelPurple, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabelSimpleObject, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jLabelModifiedObject, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addGap(96, 96, 96)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jButtonOk)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jButtonCancel))
|
|
||||||
.addComponent(canvasMyObject, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jLabelBaseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(jLabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))))
|
|
||||||
.addContainerGap(20, Short.MAX_VALUE))
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addComponent(jSpinnerSpeed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(jLabel3)
|
|
||||||
.addComponent(jSpinnerWeight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabelBaseColor, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabelDopColor, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(jLabel4)
|
|
||||||
.addComponent(jLabel5)
|
|
||||||
.addComponent(jSpinnerNumOfEngines, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(jPanelGray, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(jPanelYellow, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jPanelRed, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jPanelGreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jPanelBlue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
|
||||||
.addComponent(jLabelRect, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabelTriangle, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(jPanelWhite, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jPanelBlack, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addComponent(jPanelPurple, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabelRound, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 11, Short.MAX_VALUE)
|
|
||||||
.addComponent(jCheckBoxBombs))
|
|
||||||
.addComponent(canvasMyObject, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(jCheckBoxFuelTanks)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jCheckBoxTailLine))
|
|
||||||
.addComponent(jLabelSimpleObject, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jButtonOk, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jLabelModifiedObject, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jButtonCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void jPanelColorMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanelColorMousePressed
|
|
||||||
dragColor = ((JPanel) evt.getSource()).getBackground();
|
|
||||||
}//GEN-LAST:event_jPanelColorMousePressed
|
|
||||||
|
|
||||||
private void jLabelMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelMousePressed
|
|
||||||
typeOfAirBomber = ((JLabel) evt.getComponent()).getText();
|
|
||||||
}//GEN-LAST:event_jLabelMousePressed
|
|
||||||
|
|
||||||
private void drawAirBomber(){
|
|
||||||
if (_airBomber != null){
|
|
||||||
_airBomber.SetPosition(5, 5, canvasMyObject.getWidth(), canvasMyObject.getHeight());
|
|
||||||
canvasMyObject.setAirBomber(_airBomber);
|
|
||||||
canvasMyObject.repaint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addEvent(ITransferAirBomberDelegate ev){
|
|
||||||
eventAddAirBomber.add(ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void jLabelEngineMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelEngineMousePressed
|
|
||||||
switch (((JLabel) evt.getComponent()).getText()){
|
|
||||||
case "Квадратные":
|
|
||||||
engines = new DrawingEngines();
|
|
||||||
break;
|
|
||||||
case "Треугольные":
|
|
||||||
engines = new DrawingEnginesTriangle();
|
|
||||||
break;
|
|
||||||
case "Круглые":
|
|
||||||
engines = new DrawingEnginesOval();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jLabelEngineMousePressed
|
|
||||||
|
|
||||||
private void canvasMyObjectMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_canvasMyObjectMouseEntered
|
|
||||||
cursorInCanvasLocation = true;
|
|
||||||
}//GEN-LAST:event_canvasMyObjectMouseEntered
|
|
||||||
|
|
||||||
private void jLabelObjectMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelObjectMouseReleased
|
|
||||||
if (cursorInCanvasLocation && typeOfAirBomber != null) {
|
|
||||||
if (typeOfAirBomber == "Простой"){
|
|
||||||
_airBomber = new DrawingAirBomber((int) jSpinnerSpeed.getValue(), (int) jSpinnerWeight.getValue(), Color.WHITE, 2, EnginesType.RECTANGLE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
_airBomber = new DrawingHeavyAirBomber((int) jSpinnerSpeed.getValue(), (int) jSpinnerWeight.getValue(), Color.WHITE, 2, EnginesType.RECTANGLE,
|
|
||||||
Color.WHITE, jCheckBoxBombs.isSelected(), jCheckBoxFuelTanks.isSelected(), jCheckBoxTailLine.isSelected());
|
|
||||||
}
|
|
||||||
typeOfAirBomber = null;
|
|
||||||
drawAirBomber();
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jLabelObjectMouseReleased
|
|
||||||
|
|
||||||
private void jLabelEngineTypeMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelEngineTypeMouseReleased
|
|
||||||
if (cursorInCanvasLocation && engines != null && _airBomber != null){
|
|
||||||
engines.setNumberOfEngines(Integer.parseInt((String)jSpinnerNumOfEngines.getValue()));
|
|
||||||
_airBomber.setEngines(engines);
|
|
||||||
engines = null;
|
|
||||||
drawAirBomber();
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jLabelEngineTypeMouseReleased
|
|
||||||
|
|
||||||
private void canvasMyObjectMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_canvasMyObjectMouseExited
|
|
||||||
cursorInCanvasLocation = false;
|
|
||||||
}//GEN-LAST:event_canvasMyObjectMouseExited
|
|
||||||
|
|
||||||
private void jPanelColorMouseReleased(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jPanelColorMouseReleased
|
|
||||||
if (dragColor != null){
|
|
||||||
if (cursorInBaseLabelLocation && _airBomber != null){
|
|
||||||
_airBomber.AirBomber.setBodyColor(dragColor);
|
|
||||||
dragColor = null;
|
|
||||||
drawAirBomber();
|
|
||||||
}
|
|
||||||
else if (cursorInDopLabelLocation && _airBomber != null && _airBomber.AirBomber instanceof EntityHeavyAirBomber heavyAirBomber){
|
|
||||||
heavyAirBomber.setDopColor(dragColor);
|
|
||||||
dragColor = null;
|
|
||||||
drawAirBomber();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jPanelColorMouseReleased
|
|
||||||
|
|
||||||
private void jLabelBaseColorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelBaseColorMouseEntered
|
|
||||||
cursorInBaseLabelLocation = true;
|
|
||||||
}//GEN-LAST:event_jLabelBaseColorMouseEntered
|
|
||||||
|
|
||||||
private void jLabelBaseColorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelBaseColorMouseExited
|
|
||||||
cursorInBaseLabelLocation = false;
|
|
||||||
}//GEN-LAST:event_jLabelBaseColorMouseExited
|
|
||||||
|
|
||||||
private void jLabelDopColorMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDopColorMouseEntered
|
|
||||||
cursorInDopLabelLocation = true;
|
|
||||||
}//GEN-LAST:event_jLabelDopColorMouseEntered
|
|
||||||
|
|
||||||
private void jLabelDopColorMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelDopColorMouseExited
|
|
||||||
cursorInDopLabelLocation = false;
|
|
||||||
}//GEN-LAST:event_jLabelDopColorMouseExited
|
|
||||||
|
|
||||||
private void jButtonOkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonOkActionPerformed
|
|
||||||
for (ITransferAirBomberDelegate ev : eventAddAirBomber){
|
|
||||||
ev.Invoke(_airBomber);
|
|
||||||
}
|
|
||||||
dispose();
|
|
||||||
}//GEN-LAST:event_jButtonOkActionPerformed
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (InstantiationException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameAirBomberConfig.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() {
|
|
||||||
new JFrameAirBomberConfig().setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private AirBomberPackage.CanvasMy canvasMyObject;
|
|
||||||
private javax.swing.JButton jButtonCancel;
|
|
||||||
private javax.swing.JButton jButtonOk;
|
|
||||||
private javax.swing.JCheckBox jCheckBoxBombs;
|
|
||||||
private javax.swing.JCheckBox jCheckBoxFuelTanks;
|
|
||||||
private javax.swing.JCheckBox jCheckBoxTailLine;
|
|
||||||
private javax.swing.JLabel jLabel1;
|
|
||||||
private javax.swing.JLabel jLabel2;
|
|
||||||
private javax.swing.JLabel jLabel3;
|
|
||||||
private javax.swing.JLabel jLabel4;
|
|
||||||
private javax.swing.JLabel jLabel5;
|
|
||||||
private javax.swing.JLabel jLabelBaseColor;
|
|
||||||
private javax.swing.JLabel jLabelDopColor;
|
|
||||||
private javax.swing.JLabel jLabelModifiedObject;
|
|
||||||
private javax.swing.JLabel jLabelRect;
|
|
||||||
private javax.swing.JLabel jLabelRound;
|
|
||||||
private javax.swing.JLabel jLabelSimpleObject;
|
|
||||||
private javax.swing.JLabel jLabelTriangle;
|
|
||||||
private javax.swing.JPanel jPanelBlack;
|
|
||||||
private javax.swing.JPanel jPanelBlue;
|
|
||||||
private javax.swing.JPanel jPanelGray;
|
|
||||||
private javax.swing.JPanel jPanelGreen;
|
|
||||||
private javax.swing.JPanel jPanelPurple;
|
|
||||||
private javax.swing.JPanel jPanelRed;
|
|
||||||
private javax.swing.JPanel jPanelWhite;
|
|
||||||
private javax.swing.JPanel jPanelYellow;
|
|
||||||
private javax.swing.JSpinner jSpinnerNumOfEngines;
|
|
||||||
private javax.swing.JSpinner jSpinnerSpeed;
|
|
||||||
private javax.swing.JSpinner jSpinnerWeight;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
@ -1,171 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
|
||||||
<Properties>
|
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
|
||||||
<Property name="title" type="java.lang.String" value="Бомбардировщик"/>
|
|
||||||
</Properties>
|
|
||||||
<SyntheticProperties>
|
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
|
||||||
</SyntheticProperties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="createAirBomberButton" pref="569" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="upButton" alignment="1" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="leftButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" pref="327" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="createAirBomberButton" min="-2" pref="68" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" attributes="0">
|
|
||||||
<Component id="upButton" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="leftButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JButton" name="createAirBomberButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Создать"/>
|
|
||||||
<Property name="name" type="java.lang.String" value="createAirBomberButton" noResource="true"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createAirBomberButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="leftButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowLeft.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
|
||||||
<Insets value="[0, 0, 0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonLeft" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="downButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowDown.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonDown" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="rightButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowRight.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonRight" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="upButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowUp.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonUp" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="AirBomberPackage.CanvasMy" name="airBomberCanvas">
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,261 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class JFrameDopGenerics extends javax.swing.JFrame {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new form JFrameDopGenerics
|
|
||||||
*/
|
|
||||||
public JFrameDopGenerics() {
|
|
||||||
initComponents();
|
|
||||||
int numOfDecals = 2;
|
|
||||||
airBomberGenerator = new SetAirBombersGenericDop<>(numOfDecals);
|
|
||||||
Random rnd = new Random(System.currentTimeMillis());
|
|
||||||
for (int i = 0; i < numOfDecals; i++){
|
|
||||||
EntityAirBomber airBomber;
|
|
||||||
int rndNum = rnd.nextInt(0, 100);
|
|
||||||
if (rndNum % 2 == 0){
|
|
||||||
//создаём обычный бомбардировщик
|
|
||||||
airBomber = new EntityAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000), new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)));
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
//создаём тяжелый бомбардировщик
|
|
||||||
airBomber = new EntityHeavyAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
|
||||||
new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)),
|
|
||||||
new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)),
|
|
||||||
rnd.nextBoolean(),
|
|
||||||
rnd.nextBoolean(),
|
|
||||||
rnd.nextBoolean());
|
|
||||||
}
|
|
||||||
airBomberGenerator.add(airBomber);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < numOfDecals; i++){
|
|
||||||
int rndNum = rnd.nextInt(0, 500);
|
|
||||||
IDrawingObjectDop engines = null;
|
|
||||||
if (rndNum % 3 == 0){
|
|
||||||
//создаем квадратные двигатели
|
|
||||||
engines = new DrawingEngines();
|
|
||||||
}
|
|
||||||
else if (rndNum % 3 == 1){
|
|
||||||
//создаём треугольные двигатели
|
|
||||||
engines = new DrawingEnginesTriangle();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//создаём круглые двигатели
|
|
||||||
engines = new DrawingEnginesOval();
|
|
||||||
}
|
|
||||||
engines.setNumberOfEngines(rnd.nextInt(1,4) * 2);
|
|
||||||
airBomberGenerator.add(engines);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private DrawingAirBomber _airBomber;
|
|
||||||
private SetAirBombersGenericDop<EntityAirBomber, IDrawingObjectDop> airBomberGenerator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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() {
|
|
||||||
|
|
||||||
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();
|
|
||||||
airBomberCanvas = new AirBomberPackage.CanvasMy();
|
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
setTitle("Бомбардировщик");
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addContainerGap()
|
|
||||||
.addComponent(createAirBomberButton, javax.swing.GroupLayout.DEFAULT_SIZE, 569, Short.MAX_VALUE)
|
|
||||||
.addGap(18, 18, 18)
|
|
||||||
.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))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, 327, Short.MAX_VALUE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(createAirBomberButton, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(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))))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void createAirBomberButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createAirBomberButtonActionPerformed
|
|
||||||
_airBomber = airBomberGenerator.buildAirBomber();
|
|
||||||
SetData();
|
|
||||||
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 SetData()
|
|
||||||
{
|
|
||||||
Random rnd = new Random();
|
|
||||||
_airBomber.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100), airBomberCanvas.getWidth(), airBomberCanvas.getHeight());
|
|
||||||
airBomberCanvas.setAirBomber(_airBomber);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Draw(){
|
|
||||||
airBomberCanvas.repaint();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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(JFrameDopGenerics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (InstantiationException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameDopGenerics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameDopGenerics.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameDopGenerics.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() {
|
|
||||||
new JFrameDopGenerics().setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private AirBomberPackage.CanvasMy airBomberCanvas;
|
|
||||||
private javax.swing.JButton createAirBomberButton;
|
|
||||||
private javax.swing.JButton downButton;
|
|
||||||
private javax.swing.JButton leftButton;
|
|
||||||
private javax.swing.JButton rightButton;
|
|
||||||
private javax.swing.JButton upButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
@ -1,289 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
|
||||||
<Properties>
|
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
|
||||||
<Property name="title" type="java.lang.String" value="Бомбардировщик"/>
|
|
||||||
<Property name="alwaysOnTop" type="boolean" value="true"/>
|
|
||||||
<Property name="name" type="java.lang.String" value="FrameMap" noResource="true"/>
|
|
||||||
<Property name="size" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[700, 400]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<SyntheticProperties>
|
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
|
||||||
</SyntheticProperties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="statusLabel" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEngines" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEnginesType" min="-2" pref="107" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="createAirBomberButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="ModifyButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxMap" min="-2" pref="127" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace pref="146" max="32767" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="upButton" alignment="1" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="leftButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" min="-2" pref="30" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace min="-2" pref="17" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" pref="694" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" pref="298" max="32767" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="jLabelEngines" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEngines" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabelEngines1" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jComboBoxEnginesType" alignment="3" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
|
||||||
<Component id="createAirBomberButton" pref="31" max="32767" attributes="0"/>
|
|
||||||
<Component id="ModifyButton" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Component id="jComboBoxMap" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="upButton" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
|
||||||
<Component id="leftButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="downButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" alignment="3" min="-2" pref="31" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="statusLabel" min="-2" pref="22" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="AirBomberPackage.CanvasMy" name="airBomberCanvas">
|
|
||||||
<Properties>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[700, 300]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelEngines">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Количество двигателей: "/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JComboBox" name="jComboBoxEngines">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="3">
|
|
||||||
<StringItem index="0" value="Два"/>
|
|
||||||
<StringItem index="1" value="Четыре"/>
|
|
||||||
<StringItem index="2" value="Шесть"/>
|
|
||||||
</StringArray>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="createAirBomberButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Создать"/>
|
|
||||||
<Property name="name" type="java.lang.String" value="createAirBomberButton" noResource="true"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createAirBomberButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="statusLabel">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Скорость: Вес: Цвет: Двигатели:"/>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="leftButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowLeft.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
|
||||||
<Insets value="[0, 0, 0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonLeft" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="downButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowDown.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonDown" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="rightButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowRight.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonRight" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="upButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowUp.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonUp" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="ModifyButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Модификация"/>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
|
||||||
<Property name="name" type="java.lang.String" value="modifyButton" noResource="true"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="ModifyButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JComboBox" name="jComboBoxMap">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="3">
|
|
||||||
<StringItem index="0" value="Простая карта"/>
|
|
||||||
<StringItem index="1" value="Линейная карта"/>
|
|
||||||
<StringItem index="2" value="Городская карта"/>
|
|
||||||
</StringArray>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jComboBoxMapItemStateChanged"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JComboBox" name="jComboBoxEnginesType">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="3">
|
|
||||||
<StringItem index="0" value="Квадратный"/>
|
|
||||||
<StringItem index="1" value="Треугольный"/>
|
|
||||||
<StringItem index="2" value="Круглый"/>
|
|
||||||
</StringArray>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="itemStateChanged" listener="java.awt.event.ItemListener" parameters="java.awt.event.ItemEvent" handler="jComboBoxEnginesTypeItemStateChanged"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabelEngines1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Тип двигателей: "/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,337 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
import java.util.*;
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class JFrameMap extends javax.swing.JFrame {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new form JFrameMap
|
|
||||||
*/
|
|
||||||
public JFrameMap() {
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
private DrawingAirBomber _airBomber;
|
|
||||||
private AbstractMap _abstractMap = new SimpleMap();
|
|
||||||
private EnginesType enginesType = EnginesType.RECTANGLE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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() {
|
|
||||||
|
|
||||||
airBomberCanvas = new AirBomberPackage.CanvasMy();
|
|
||||||
jLabelEngines = new javax.swing.JLabel();
|
|
||||||
jComboBoxEngines = new javax.swing.JComboBox<>();
|
|
||||||
createAirBomberButton = new javax.swing.JButton();
|
|
||||||
statusLabel = new javax.swing.JLabel();
|
|
||||||
leftButton = new javax.swing.JButton();
|
|
||||||
downButton = new javax.swing.JButton();
|
|
||||||
rightButton = new javax.swing.JButton();
|
|
||||||
upButton = new javax.swing.JButton();
|
|
||||||
ModifyButton = new javax.swing.JButton();
|
|
||||||
jComboBoxMap = new javax.swing.JComboBox<>();
|
|
||||||
jComboBoxEnginesType = new javax.swing.JComboBox<>();
|
|
||||||
jLabelEngines1 = new javax.swing.JLabel();
|
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
setTitle("Бомбардировщик");
|
|
||||||
setAlwaysOnTop(true);
|
|
||||||
setName("FrameMap"); // NOI18N
|
|
||||||
setSize(new java.awt.Dimension(700, 400));
|
|
||||||
|
|
||||||
airBomberCanvas.setPreferredSize(new java.awt.Dimension(700, 300));
|
|
||||||
|
|
||||||
jLabelEngines.setText("Количество двигателей: ");
|
|
||||||
|
|
||||||
jComboBoxEngines.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Два", "Четыре", "Шесть" }));
|
|
||||||
|
|
||||||
createAirBomberButton.setText("Создать");
|
|
||||||
createAirBomberButton.setName("createAirBomberButton"); // NOI18N
|
|
||||||
createAirBomberButton.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
createAirBomberButtonActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
statusLabel.setText("Скорость: Вес: Цвет: Двигатели:");
|
|
||||||
statusLabel.setMinimumSize(new java.awt.Dimension(0, 0));
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jComboBoxMap.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Простая карта", "Линейная карта", "Городская карта" }));
|
|
||||||
jComboBoxMap.addItemListener(new java.awt.event.ItemListener() {
|
|
||||||
public void itemStateChanged(java.awt.event.ItemEvent evt) {
|
|
||||||
jComboBoxMapItemStateChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabelEngines1.setText("Тип двигателей: ");
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.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)
|
|
||||||
.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, 107, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(createAirBomberButton)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(ModifyButton)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
|
||||||
.addComponent(jComboBoxMap, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 146, Short.MAX_VALUE)
|
|
||||||
.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))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, 694, Short.MAX_VALUE)
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.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)
|
|
||||||
.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))
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(createAirBomberButton, javax.swing.GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
|
|
||||||
.addComponent(ModifyButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(jComboBoxMap)))
|
|
||||||
.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))
|
|
||||||
);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void createAirBomberButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createAirBomberButtonActionPerformed
|
|
||||||
Random rnd = new Random();
|
|
||||||
_airBomber = new DrawingAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000), new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)), (jComboBoxEngines.getSelectedIndex() + 1) * 2, enginesType);
|
|
||||||
SetData(_airBomber);
|
|
||||||
}//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();
|
|
||||||
Direction dir = Direction.NONE;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
dir = Direction.UP;
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
dir = Direction.DOWN;
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
dir = Direction.LEFT;
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
dir = Direction.RIGHT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_abstractMap.MoveObject(dir), 0, 0, null);
|
|
||||||
}//GEN-LAST:event_moveButtonActionPerformed
|
|
||||||
|
|
||||||
private void ModifyButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ModifyButtonActionPerformed
|
|
||||||
Random rnd = new Random();
|
|
||||||
_airBomber = new DrawingHeavyAirBomber(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
|
||||||
new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)),
|
|
||||||
(jComboBoxEngines.getSelectedIndex() + 1) * 2,
|
|
||||||
enginesType,
|
|
||||||
new Color(rnd.nextInt(0, 256), rnd.nextInt(0, 256), rnd.nextInt(0, 256)),
|
|
||||||
rnd.nextBoolean(), rnd.nextBoolean(), rnd.nextBoolean());
|
|
||||||
SetData(_airBomber);
|
|
||||||
}//GEN-LAST:event_ModifyButtonActionPerformed
|
|
||||||
|
|
||||||
private void jComboBoxMapItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_jComboBoxMapItemStateChanged
|
|
||||||
switch (jComboBoxMap.getSelectedIndex())
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
_abstractMap = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
_abstractMap = new LineMap();
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
_abstractMap = new CityMap();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jComboBoxMapItemStateChanged
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
private void SetData(DrawingAirBomber airBomber)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_abstractMap.CreateMap(airBomberCanvas.getWidth() + 6, airBomberCanvas.getHeight() + 3, new DrawingObjectAirBomber(airBomber)), 0,0,null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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(JFrameMap.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (InstantiationException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMap.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMap.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMap.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() {
|
|
||||||
new JFrameMap().setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private javax.swing.JButton ModifyButton;
|
|
||||||
private AirBomberPackage.CanvasMy airBomberCanvas;
|
|
||||||
private javax.swing.JButton createAirBomberButton;
|
|
||||||
private javax.swing.JButton downButton;
|
|
||||||
private javax.swing.JComboBox<String> jComboBoxEngines;
|
|
||||||
private javax.swing.JComboBox<String> jComboBoxEnginesType;
|
|
||||||
private javax.swing.JComboBox<String> jComboBoxMap;
|
|
||||||
private javax.swing.JLabel jLabelEngines;
|
|
||||||
private javax.swing.JLabel jLabelEngines1;
|
|
||||||
private javax.swing.JButton leftButton;
|
|
||||||
private javax.swing.JButton rightButton;
|
|
||||||
private javax.swing.JLabel statusLabel;
|
|
||||||
private javax.swing.JButton upButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
@ -1,363 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" ?>
|
|
||||||
|
|
||||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
|
|
||||||
<NonVisualComponents>
|
|
||||||
<Component class="javax.swing.JFileChooser" name="jFileChooser1">
|
|
||||||
</Component>
|
|
||||||
<Menu class="javax.swing.JMenuBar" name="jMenuBar1">
|
|
||||||
<SubComponents>
|
|
||||||
<Menu class="javax.swing.JMenu" name="jMenuSaveLoad">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="File"/>
|
|
||||||
</Properties>
|
|
||||||
<SubComponents>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemSave">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Сохранить"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemSaveActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemLoad">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Загрузить"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemLoadActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemSaveStorage">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Сохранить хранилище"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemSaveStorageActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</MenuItem>
|
|
||||||
<MenuItem class="javax.swing.JMenuItem" name="jMenuItemLoadStorage">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Загрузить хранилище"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jMenuItemLoadStorageActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</MenuItem>
|
|
||||||
</SubComponents>
|
|
||||||
</Menu>
|
|
||||||
</SubComponents>
|
|
||||||
</Menu>
|
|
||||||
</NonVisualComponents>
|
|
||||||
<Properties>
|
|
||||||
<Property name="defaultCloseOperation" type="int" value="3"/>
|
|
||||||
</Properties>
|
|
||||||
<SyntheticProperties>
|
|
||||||
<SyntheticProperty name="menuBar" type="java.lang.String" value="jMenuBar1"/>
|
|
||||||
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
|
|
||||||
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
|
|
||||||
</SyntheticProperties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
|
||||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
|
||||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
|
||||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
|
||||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout>
|
|
||||||
<DimensionLayout dim="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" min="-2" pref="664" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace pref="59" max="32767" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="buttonDeleteMap" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" max="-2" attributes="0">
|
|
||||||
<Component id="buttonAddAirBomber" max="32767" attributes="0"/>
|
|
||||||
<Component id="maskedTextBoxPosition" max="32767" attributes="0"/>
|
|
||||||
<Component id="buttonRemoveAirBomber" max="32767" attributes="0"/>
|
|
||||||
<Component id="buttonShowStorage" max="32767" attributes="0"/>
|
|
||||||
<Component id="buttonShowOnMap" alignment="1" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Component id="jScrollPane1" alignment="1" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonAddMap" alignment="1" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
<Component id="comboBoxSelectorMap" alignment="1" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
<Component id="textBoxNewMapName" alignment="1" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonShowDeleted" alignment="1" min="-2" pref="188" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="jLabel2" min="-2" pref="75" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="23" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<Group type="102" alignment="1" attributes="0">
|
|
||||||
<Component id="leftButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="upButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<Component id="downButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace min="-2" pref="62" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
<DimensionLayout dim="1">
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
|
||||||
<Component id="airBomberCanvas" alignment="0" max="32767" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="-2" pref="15" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="textBoxNewMapName" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="comboBoxSelectorMap" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonAddMap" min="-2" pref="35" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="jScrollPane1" min="-2" pref="78" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonDeleteMap" min="-2" pref="34" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace pref="22" max="32767" attributes="0"/>
|
|
||||||
<Component id="buttonShowDeleted" min="-2" pref="36" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonAddAirBomber" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="maskedTextBoxPosition" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonRemoveAirBomber" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonShowStorage" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="buttonShowOnMap" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="upButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="1" attributes="0">
|
|
||||||
<Component id="downButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="leftButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="rightButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
|
||||||
</Group>
|
|
||||||
</DimensionLayout>
|
|
||||||
</Layout>
|
|
||||||
<SubComponents>
|
|
||||||
<Container class="AirBomberPackage.CanvasMy" name="airBomberCanvas">
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
|
|
||||||
<Property name="useNullLayout" type="boolean" value="true"/>
|
|
||||||
</Layout>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JComboBox" name="comboBoxSelectorMap">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
|
||||||
<StringArray count="0"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonAddAirBomber">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Добавить бомбардировщик"/>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddAirBomberActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JFormattedTextField" name="maskedTextBoxPosition">
|
|
||||||
<Properties>
|
|
||||||
<Property name="formatterFactory" type="javax.swing.JFormattedTextField$AbstractFormatterFactory" editor="org.netbeans.modules.form.editors.AbstractFormatterFactoryEditor" preCode="try {" postCode="} catch (java.text.ParseException ex) {
ex.printStackTrace();
}">
|
|
||||||
<Format format="##" subtype="-1" type="5"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonRemoveAirBomber">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Удалить бомбардировщик"/>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" value=""/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonRemoveAirBomberActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonShowStorage">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Посмотреть хранилище"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonShowStorageActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonShowOnMap">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Посмотреть карту"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonShowOnMapActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="leftButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowLeft.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
|
|
||||||
<Insets value="[0, 0, 0, 0]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonLeft" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="downButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowDown.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonDown" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="rightButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowRight.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonRight" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="upButton">
|
|
||||||
<Properties>
|
|
||||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
|
||||||
<Image iconType="3" name="/AirBomberPackage/arrowUp.png"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="name" type="java.lang.String" value="buttonUp" noResource="true"/>
|
|
||||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
|
||||||
<Dimension value="[30, 30]"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="moveButtonActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Инструменты"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JLabel" name="jLabel2">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Карты"/>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JTextField" name="textBoxNewMapName">
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonAddMap">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Добавить карту"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonAddMapActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
|
|
||||||
</AuxValues>
|
|
||||||
|
|
||||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
|
||||||
<SubComponents>
|
|
||||||
<Component class="javax.swing.JList" name="listBoxMaps">
|
|
||||||
<Properties>
|
|
||||||
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
|
|
||||||
<StringArray count="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="selectionMode" type="int" value="0"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="valueChanged" listener="javax.swing.event.ListSelectionListener" parameters="javax.swing.event.ListSelectionEvent" handler="listBoxMapsValueChanged"/>
|
|
||||||
</Events>
|
|
||||||
<AuxValues>
|
|
||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
|
||||||
</AuxValues>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Container>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonDeleteMap">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Удалить карту"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonDeleteMapActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
<Component class="javax.swing.JButton" name="buttonShowDeleted">
|
|
||||||
<Properties>
|
|
||||||
<Property name="text" type="java.lang.String" value="Показать удалённый"/>
|
|
||||||
</Properties>
|
|
||||||
<Events>
|
|
||||||
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="buttonShowDeletedActionPerformed"/>
|
|
||||||
</Events>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
|
||||||
</Form>
|
|
@ -1,551 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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;
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.DefaultListModel;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import javax.swing.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class JFrameMapWithSetAirBombers extends javax.swing.JFrame {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates new form JFrameMapWithSetAirBombers
|
|
||||||
*/
|
|
||||||
public JFrameMapWithSetAirBombers() {
|
|
||||||
initComponents();
|
|
||||||
_mapsDict.put("Простая карта", new SimpleMap());
|
|
||||||
_mapsDict.put("Городская карта", new CityMap());
|
|
||||||
_mapsDict.put("Линейная карта", new LineMap());
|
|
||||||
_mapsCollection = new MapsCollection(airBomberCanvas.getWidth(),airBomberCanvas.getHeight());
|
|
||||||
DefaultComboBoxModel defaultcombModel = new DefaultComboBoxModel();
|
|
||||||
comboBoxSelectorMap.setModel(defaultcombModel);
|
|
||||||
for (var elem : _mapsDict.keySet()){
|
|
||||||
comboBoxSelectorMap.addItem(elem);
|
|
||||||
}
|
|
||||||
comboBoxSelectorMap.setSelectedIndex(-1);
|
|
||||||
}
|
|
||||||
private HashMap<String, AbstractMap> _mapsDict = new HashMap<>();
|
|
||||||
|
|
||||||
private MapsCollection _mapsCollection;
|
|
||||||
|
|
||||||
private LinkedList<DrawingObjectAirBomber> deletedAirBombers = new LinkedList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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() {
|
|
||||||
|
|
||||||
jFileChooser1 = new javax.swing.JFileChooser();
|
|
||||||
airBomberCanvas = new AirBomberPackage.CanvasMy();
|
|
||||||
comboBoxSelectorMap = new javax.swing.JComboBox<>();
|
|
||||||
buttonAddAirBomber = new javax.swing.JButton();
|
|
||||||
maskedTextBoxPosition = new javax.swing.JFormattedTextField();
|
|
||||||
buttonRemoveAirBomber = new javax.swing.JButton();
|
|
||||||
buttonShowStorage = new javax.swing.JButton();
|
|
||||||
buttonShowOnMap = new javax.swing.JButton();
|
|
||||||
leftButton = new javax.swing.JButton();
|
|
||||||
downButton = new javax.swing.JButton();
|
|
||||||
rightButton = new javax.swing.JButton();
|
|
||||||
upButton = new javax.swing.JButton();
|
|
||||||
jLabel1 = new javax.swing.JLabel();
|
|
||||||
jLabel2 = new javax.swing.JLabel();
|
|
||||||
textBoxNewMapName = new javax.swing.JTextField();
|
|
||||||
buttonAddMap = new javax.swing.JButton();
|
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
|
||||||
listBoxMaps = new javax.swing.JList<>();
|
|
||||||
buttonDeleteMap = new javax.swing.JButton();
|
|
||||||
buttonShowDeleted = new javax.swing.JButton();
|
|
||||||
jMenuBar1 = new javax.swing.JMenuBar();
|
|
||||||
jMenuSaveLoad = new javax.swing.JMenu();
|
|
||||||
jMenuItemSave = new javax.swing.JMenuItem();
|
|
||||||
jMenuItemLoad = new javax.swing.JMenuItem();
|
|
||||||
jMenuItemSaveStorage = new javax.swing.JMenuItem();
|
|
||||||
jMenuItemLoadStorage = new javax.swing.JMenuItem();
|
|
||||||
|
|
||||||
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
|
|
||||||
|
|
||||||
buttonAddAirBomber.setText("Добавить бомбардировщик");
|
|
||||||
buttonAddAirBomber.setToolTipText("");
|
|
||||||
buttonAddAirBomber.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonAddAirBomberActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
maskedTextBoxPosition.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("##")));
|
|
||||||
} catch (java.text.ParseException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
buttonRemoveAirBomber.setText("Удалить бомбардировщик");
|
|
||||||
buttonRemoveAirBomber.setToolTipText("");
|
|
||||||
buttonRemoveAirBomber.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonRemoveAirBomberActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonShowStorage.setText("Посмотреть хранилище");
|
|
||||||
buttonShowStorage.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonShowStorageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonShowOnMap.setText("Посмотреть карту");
|
|
||||||
buttonShowOnMap.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonShowOnMapActionPerformed(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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jLabel1.setText("Инструменты");
|
|
||||||
|
|
||||||
jLabel2.setText("Карты");
|
|
||||||
|
|
||||||
buttonAddMap.setText("Добавить карту");
|
|
||||||
buttonAddMap.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonAddMapActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
listBoxMaps.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
|
|
||||||
listBoxMaps.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
|
||||||
public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
|
|
||||||
listBoxMapsValueChanged(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jScrollPane1.setViewportView(listBoxMaps);
|
|
||||||
|
|
||||||
buttonDeleteMap.setText("Удалить карту");
|
|
||||||
buttonDeleteMap.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonDeleteMapActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
buttonShowDeleted.setText("Показать удалённый");
|
|
||||||
buttonShowDeleted.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
buttonShowDeletedActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
jMenuSaveLoad.setText("File");
|
|
||||||
|
|
||||||
jMenuItemSave.setText("Сохранить");
|
|
||||||
jMenuItemSave.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jMenuItemSaveActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jMenuSaveLoad.add(jMenuItemSave);
|
|
||||||
|
|
||||||
jMenuItemLoad.setText("Загрузить");
|
|
||||||
jMenuItemLoad.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jMenuItemLoadActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jMenuSaveLoad.add(jMenuItemLoad);
|
|
||||||
|
|
||||||
jMenuItemSaveStorage.setText("Сохранить хранилище");
|
|
||||||
jMenuItemSaveStorage.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jMenuItemSaveStorageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jMenuSaveLoad.add(jMenuItemSaveStorage);
|
|
||||||
|
|
||||||
jMenuItemLoadStorage.setText("Загрузить хранилище");
|
|
||||||
jMenuItemLoadStorage.addActionListener(new java.awt.event.ActionListener() {
|
|
||||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
|
||||||
jMenuItemLoadStorageActionPerformed(evt);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
jMenuSaveLoad.add(jMenuItemLoadStorage);
|
|
||||||
|
|
||||||
jMenuBar1.add(jMenuSaveLoad);
|
|
||||||
|
|
||||||
setJMenuBar(jMenuBar1);
|
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
|
||||||
getContentPane().setLayout(layout);
|
|
||||||
layout.setHorizontalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.PREFERRED_SIZE, 664, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(buttonDeleteMap, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
|
|
||||||
.addComponent(buttonAddAirBomber, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(maskedTextBoxPosition)
|
|
||||||
.addComponent(buttonRemoveAirBomber, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(buttonShowStorage, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addComponent(buttonShowOnMap, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(buttonAddMap, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(comboBoxSelectorMap, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(textBoxNewMapName, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(buttonShowDeleted, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(jLabel1)))
|
|
||||||
.addGap(23, 23, 23))
|
|
||||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
|
||||||
.addComponent(leftButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addComponent(downButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(rightButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
|
|
||||||
.addGap(62, 62, 62))))
|
|
||||||
);
|
|
||||||
layout.setVerticalGroup(
|
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
|
||||||
.addComponent(airBomberCanvas, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
|
||||||
.addGap(15, 15, 15)
|
|
||||||
.addComponent(jLabel1)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jLabel2)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(textBoxNewMapName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(comboBoxSelectorMap, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonAddMap, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonDeleteMap, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 22, Short.MAX_VALUE)
|
|
||||||
.addComponent(buttonShowDeleted, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonAddAirBomber)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(maskedTextBoxPosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonRemoveAirBomber)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonShowStorage)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(buttonShowOnMap)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addComponent(upButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
|
||||||
.addComponent(downButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(leftButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(rightButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
|
||||||
.addContainerGap())
|
|
||||||
);
|
|
||||||
|
|
||||||
pack();
|
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
|
||||||
|
|
||||||
private void moveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveButtonActionPerformed
|
|
||||||
String name = ((JButton) evt.getSource()).getName();
|
|
||||||
Direction dir = Direction.NONE;
|
|
||||||
switch (name)
|
|
||||||
{
|
|
||||||
case "buttonUp":
|
|
||||||
dir = Direction.UP;
|
|
||||||
break;
|
|
||||||
case "buttonDown":
|
|
||||||
dir = Direction.DOWN;
|
|
||||||
break;
|
|
||||||
case "buttonLeft":
|
|
||||||
dir = Direction.LEFT;
|
|
||||||
break;
|
|
||||||
case "buttonRight":
|
|
||||||
dir = Direction.RIGHT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).MoveObject(dir), 0, 0, null);
|
|
||||||
}//GEN-LAST:event_moveButtonActionPerformed
|
|
||||||
|
|
||||||
private void buttonAddAirBomberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddAirBomberActionPerformed
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JFrameAirBomberConfig airBomberConfig = new JFrameAirBomberConfig();
|
|
||||||
airBomberConfig.addEvent(airBomber -> {_mapsCollection.Get(listBoxMaps.getSelectedValue()).add(new DrawingObjectAirBomber(airBomber));
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);});
|
|
||||||
airBomberConfig.setVisible(true);
|
|
||||||
}//GEN-LAST:event_buttonAddAirBomberActionPerformed
|
|
||||||
|
|
||||||
private void buttonRemoveAirBomberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonRemoveAirBomberActionPerformed
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (maskedTextBoxPosition.getText().isBlank() || maskedTextBoxPosition.getText().isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var res = JOptionPane.showConfirmDialog((Component) this, (Object) "Удалить объект?", "Удаление", JOptionPane.OK_CANCEL_OPTION);
|
|
||||||
if (res == JOptionPane.CANCEL_OPTION)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int pos = Integer.parseInt(maskedTextBoxPosition.getText());
|
|
||||||
DrawingObjectAirBomber deletedAirBomber = (DrawingObjectAirBomber) _mapsCollection.Get(listBoxMaps.getSelectedValue()).remove(pos);
|
|
||||||
if (deletedAirBomber != null)
|
|
||||||
{
|
|
||||||
deletedAirBombers.add(deletedAirBomber);
|
|
||||||
JOptionPane.showMessageDialog(null,"Объект удален");
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
JOptionPane.showMessageDialog(null,"Не удалось удалить объект!");
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_buttonRemoveAirBomberActionPerformed
|
|
||||||
|
|
||||||
private void buttonShowStorageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowStorageActionPerformed
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);
|
|
||||||
}//GEN-LAST:event_buttonShowStorageActionPerformed
|
|
||||||
|
|
||||||
private void buttonShowOnMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowOnMapActionPerformed
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowOnMap(), 0, 0, null);
|
|
||||||
}//GEN-LAST:event_buttonShowOnMapActionPerformed
|
|
||||||
|
|
||||||
private void buttonAddMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAddMapActionPerformed
|
|
||||||
if (comboBoxSelectorMap.getSelectedIndex() == -1 || textBoxNewMapName.getText().isBlank()){
|
|
||||||
JOptionPane.showMessageDialog(this, "Не все данные заполнены!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!_mapsDict.containsKey((String) comboBoxSelectorMap.getSelectedItem())){
|
|
||||||
JOptionPane.showMessageDialog(this, "Нет такой карты!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_mapsCollection.AddMap(textBoxNewMapName.getText(), _mapsDict.get((String) comboBoxSelectorMap.getSelectedItem()));
|
|
||||||
ReloadMaps();
|
|
||||||
}//GEN-LAST:event_buttonAddMapActionPerformed
|
|
||||||
|
|
||||||
private void buttonDeleteMapActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonDeleteMapActionPerformed
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (JOptionPane.showConfirmDialog(this, (Object) ("Удалить карту " + listBoxMaps.getSelectedValue() + "?") , "Удаление", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION){
|
|
||||||
_mapsCollection.DelMap(listBoxMaps.getSelectedValue());
|
|
||||||
ReloadMaps();
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_buttonDeleteMapActionPerformed
|
|
||||||
|
|
||||||
private void buttonShowDeletedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonShowDeletedActionPerformed
|
|
||||||
if (deletedAirBombers.isEmpty()){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
JFrameAirBomber form = new JFrameAirBomber(this, deletedAirBombers.poll());
|
|
||||||
form.run();
|
|
||||||
}//GEN-LAST:event_buttonShowDeletedActionPerformed
|
|
||||||
|
|
||||||
private void listBoxMapsValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listBoxMapsValueChanged
|
|
||||||
if (listBoxMaps.getSelectedIndex() == -1){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
airBomberCanvas.getGraphics().drawImage(_mapsCollection.Get(listBoxMaps.getSelectedValue()).ShowSet(), 0, 0, null);
|
|
||||||
}//GEN-LAST:event_listBoxMapsValueChanged
|
|
||||||
|
|
||||||
private void jMenuItemSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSaveActionPerformed
|
|
||||||
if (jFileChooser1.showDialog(this, "Сохранить") == JFileChooser.APPROVE_OPTION){
|
|
||||||
if (_mapsCollection.SaveData(jFileChooser1.getSelectedFile().getPath())){
|
|
||||||
JOptionPane.showMessageDialog(this, "Cохранено");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
JOptionPane.showMessageDialog(this, "Не сохранилось");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jMenuItemSaveActionPerformed
|
|
||||||
|
|
||||||
private void jMenuItemLoadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLoadActionPerformed
|
|
||||||
if (jFileChooser1.showDialog(this, "Загрузить") == JFileChooser.APPROVE_OPTION){
|
|
||||||
if (_mapsCollection.LoadData(jFileChooser1.getSelectedFile().getPath())){
|
|
||||||
JOptionPane.showMessageDialog(this, "Загрузилось");
|
|
||||||
ReloadMaps();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
JOptionPane.showMessageDialog(this, "Не загрузилось");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jMenuItemLoadActionPerformed
|
|
||||||
|
|
||||||
private void jMenuItemSaveStorageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemSaveStorageActionPerformed
|
|
||||||
if (jFileChooser1.showDialog(this, "Сохранить") == JFileChooser.APPROVE_OPTION){
|
|
||||||
if (_mapsCollection.SaveStorage(jFileChooser1.getSelectedFile().getPath(), listBoxMaps.getSelectedValue())){
|
|
||||||
JOptionPane.showMessageDialog(this, "Cохранено");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
JOptionPane.showMessageDialog(this, "Не сохранилось");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jMenuItemSaveStorageActionPerformed
|
|
||||||
|
|
||||||
private void jMenuItemLoadStorageActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemLoadStorageActionPerformed
|
|
||||||
if (jFileChooser1.showDialog(this, "Загрузить") == JFileChooser.APPROVE_OPTION){
|
|
||||||
if (_mapsCollection.LoadStorage(jFileChooser1.getSelectedFile().getPath())){
|
|
||||||
JOptionPane.showMessageDialog(this, "Загрузилось");
|
|
||||||
ReloadMaps();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
JOptionPane.showMessageDialog(this, "Не загрузилось");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}//GEN-LAST:event_jMenuItemLoadStorageActionPerformed
|
|
||||||
|
|
||||||
private void ReloadMaps()
|
|
||||||
{
|
|
||||||
int index = listBoxMaps.getSelectedIndex();
|
|
||||||
|
|
||||||
DefaultListModel listBoxMapsModel = new DefaultListModel();
|
|
||||||
listBoxMapsModel.clear();
|
|
||||||
for (int i = 0; i < _mapsCollection.getKeys().size(); i++)
|
|
||||||
{
|
|
||||||
listBoxMapsModel.addElement(_mapsCollection.getKeys().get(i));
|
|
||||||
}
|
|
||||||
listBoxMaps.setModel(listBoxMapsModel);
|
|
||||||
if (listBoxMapsModel.size() > 0 && (index == -1 || index >= listBoxMapsModel.size()))
|
|
||||||
{
|
|
||||||
listBoxMaps.setSelectedIndex(0);
|
|
||||||
}
|
|
||||||
else if (listBoxMapsModel.size() > 0 && index > -1 && index < listBoxMapsModel.size())
|
|
||||||
{
|
|
||||||
listBoxMaps.setSelectedIndex(index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @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(JFrameMapWithSetAirBombers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (InstantiationException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMapWithSetAirBombers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMapWithSetAirBombers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
|
|
||||||
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
|
|
||||||
java.util.logging.Logger.getLogger(JFrameMapWithSetAirBombers.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() {
|
|
||||||
new JFrameMapWithSetAirBombers().setVisible(true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
|
||||||
private AirBomberPackage.CanvasMy airBomberCanvas;
|
|
||||||
private javax.swing.JButton buttonAddAirBomber;
|
|
||||||
private javax.swing.JButton buttonAddMap;
|
|
||||||
private javax.swing.JButton buttonDeleteMap;
|
|
||||||
private javax.swing.JButton buttonRemoveAirBomber;
|
|
||||||
private javax.swing.JButton buttonShowDeleted;
|
|
||||||
private javax.swing.JButton buttonShowOnMap;
|
|
||||||
private javax.swing.JButton buttonShowStorage;
|
|
||||||
private javax.swing.JComboBox<String> comboBoxSelectorMap;
|
|
||||||
private javax.swing.JButton downButton;
|
|
||||||
private javax.swing.JFileChooser jFileChooser1;
|
|
||||||
private javax.swing.JLabel jLabel1;
|
|
||||||
private javax.swing.JLabel jLabel2;
|
|
||||||
private javax.swing.JMenuBar jMenuBar1;
|
|
||||||
private javax.swing.JMenuItem jMenuItemLoad;
|
|
||||||
private javax.swing.JMenuItem jMenuItemLoadStorage;
|
|
||||||
private javax.swing.JMenuItem jMenuItemSave;
|
|
||||||
private javax.swing.JMenuItem jMenuItemSaveStorage;
|
|
||||||
private javax.swing.JMenu jMenuSaveLoad;
|
|
||||||
private javax.swing.JScrollPane jScrollPane1;
|
|
||||||
private javax.swing.JButton leftButton;
|
|
||||||
private javax.swing.JList<String> listBoxMaps;
|
|
||||||
private javax.swing.JFormattedTextField maskedTextBoxPosition;
|
|
||||||
private javax.swing.JButton rightButton;
|
|
||||||
private javax.swing.JTextField textBoxNewMapName;
|
|
||||||
private javax.swing.JButton upButton;
|
|
||||||
// End of variables declaration//GEN-END:variables
|
|
||||||
}
|
|
@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class LineMap extends AbstractMap {
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка закрытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color barrierColor = Color.BLACK;
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка открытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color roadColor = Color.CYAN;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void DrawBarrierPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(barrierColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void DrawRoadPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(roadColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void GenerateMap()
|
|
||||||
{
|
|
||||||
_map = new int[100][100];
|
|
||||||
_size_x = _width / _map.length;
|
|
||||||
_size_y = _height / _map[0].length;
|
|
||||||
int lineCounter = 0;
|
|
||||||
int numOfLines = _random.nextInt(1, 4);
|
|
||||||
for (int i = 0; i < _map.length; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _map[0].length; ++j)
|
|
||||||
{
|
|
||||||
_map[i][j] = _freeRoad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (lineCounter < numOfLines)
|
|
||||||
{
|
|
||||||
int randomInt = _random.nextInt(0, 1000);
|
|
||||||
boolean vertical = false;
|
|
||||||
if (randomInt % 2 == 0) vertical = true;
|
|
||||||
if (vertical)
|
|
||||||
{
|
|
||||||
int x = _random.nextInt(0, 89);
|
|
||||||
int lineWidth = _random.nextInt(2, 5);
|
|
||||||
if (x + lineWidth >= _map.length) x = _random.nextInt(_map.length - lineWidth - 1, _map.length);
|
|
||||||
|
|
||||||
boolean isFreeSpace = true;
|
|
||||||
for (int i = x; i < x + lineWidth; i++)
|
|
||||||
{
|
|
||||||
if (_map[i][0] != _freeRoad) isFreeSpace = false;
|
|
||||||
}
|
|
||||||
if (isFreeSpace)
|
|
||||||
{
|
|
||||||
for (int i = x; i < x + lineWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _map.length; j++)
|
|
||||||
{
|
|
||||||
_map[i][j] = _barrier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lineCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int y = _random.nextInt(0, 89);
|
|
||||||
int lineHeigth = _random.nextInt(2, 5);
|
|
||||||
if (y + lineHeigth >= _map[0].length) y = _random.nextInt(_map[0].length - lineHeigth - 1, _map[0].length);
|
|
||||||
|
|
||||||
boolean isFreeSpace = true;
|
|
||||||
for (int j = y; j < y + lineHeigth; j++)
|
|
||||||
{
|
|
||||||
if (_map[0][j] != _freeRoad) isFreeSpace = false;
|
|
||||||
}
|
|
||||||
if (isFreeSpace)
|
|
||||||
{
|
|
||||||
for (int j = y; j < y + lineHeigth; j++)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < _map[0].length; i++)
|
|
||||||
{
|
|
||||||
_map[i][j] = _barrier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
lineCounter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,153 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class MapWithSetAirBombersGeneric <T extends IDrawingObject, U extends AbstractMap> {
|
|
||||||
private int _pictureWidth;
|
|
||||||
private int _pictureHeight;
|
|
||||||
private int _placeSizeWidth = 110;
|
|
||||||
private int _placeSizeHeight = 100;
|
|
||||||
private SetAirBombersGeneric<T> _setAirBombers;
|
|
||||||
private U _map;
|
|
||||||
public MapWithSetAirBombersGeneric(int picWidth, int picHeight, U map)
|
|
||||||
{
|
|
||||||
int width = picWidth / _placeSizeWidth;
|
|
||||||
int height = picHeight / _placeSizeHeight;
|
|
||||||
_setAirBombers = new SetAirBombersGeneric<T>(width * height);
|
|
||||||
_pictureWidth = picWidth;
|
|
||||||
_pictureHeight = picHeight;
|
|
||||||
_map = map;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SetAirBombersGeneric<T> getSetAirBombers(){
|
|
||||||
return _setAirBombers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int add(T airBomber){
|
|
||||||
return _setAirBombers.Insert(airBomber);
|
|
||||||
}
|
|
||||||
|
|
||||||
public T remove(int position){
|
|
||||||
return _setAirBombers.Remove(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage ShowSet()
|
|
||||||
{
|
|
||||||
BufferedImage bmp = new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
Graphics2D gr = bmp.createGraphics();
|
|
||||||
DrawBackground(gr);
|
|
||||||
DrawAirBombers(gr);
|
|
||||||
return bmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage ShowOnMap()
|
|
||||||
{
|
|
||||||
Shaking();
|
|
||||||
for (int i = 0; i < _setAirBombers.getCount(); i++)
|
|
||||||
{
|
|
||||||
var airBomber = _setAirBombers.Get(i);
|
|
||||||
if (airBomber != null)
|
|
||||||
{
|
|
||||||
return _map.CreateMap(700, 700, airBomber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
}
|
|
||||||
|
|
||||||
public BufferedImage MoveObject(Direction direction)
|
|
||||||
{
|
|
||||||
if (_map != null)
|
|
||||||
{
|
|
||||||
return _map.MoveObject(direction);
|
|
||||||
}
|
|
||||||
return new BufferedImage(_pictureWidth, _pictureHeight, BufferedImage.TYPE_INT_ARGB);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение данных в виде строки
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="sep"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public String GetData(String separatorType, String separatorData)
|
|
||||||
{
|
|
||||||
String data = _map.getClass().getSimpleName() + separatorType;
|
|
||||||
for (var airBomber : _setAirBombers.GetAirBombers())
|
|
||||||
{
|
|
||||||
data += airBomber.GetInfo() + separatorData;
|
|
||||||
}
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
public void LoadData(String[] records)
|
|
||||||
{
|
|
||||||
for (var rec : records)
|
|
||||||
{
|
|
||||||
_setAirBombers.Insert((T) DrawingObjectAirBomber.Create(rec));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clearStorage(){
|
|
||||||
_setAirBombers.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Shaking()
|
|
||||||
{
|
|
||||||
int j = _setAirBombers.getCount() - 1;
|
|
||||||
for (int i = 0; i < _setAirBombers.getCount(); i++)
|
|
||||||
{
|
|
||||||
if (_setAirBombers.Get(i) == null)
|
|
||||||
{
|
|
||||||
for (; j > i; j--)
|
|
||||||
{
|
|
||||||
var car = _setAirBombers.Get(j);
|
|
||||||
if (car != null)
|
|
||||||
{
|
|
||||||
_setAirBombers.Insert(car, i);
|
|
||||||
_setAirBombers.Remove(j);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (j <= i)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawBackground(Graphics2D g)
|
|
||||||
{
|
|
||||||
g.setColor(Color.GRAY);
|
|
||||||
g.fillRect(0, 0, _pictureWidth, _pictureHeight);
|
|
||||||
g.setColor(Color.WHITE);
|
|
||||||
g.setStroke(new BasicStroke(3));
|
|
||||||
for (int i = 0; i < _pictureWidth / _placeSizeWidth; i++)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
|
||||||
{//линия рамзетки места
|
|
||||||
g.drawLine(i * _placeSizeWidth, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2, j * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
g.drawLine(i * _placeSizeWidth, 0, i * _placeSizeWidth, (_pictureHeight / _placeSizeHeight) * _placeSizeHeight);
|
|
||||||
}
|
|
||||||
g.setStroke(new BasicStroke(1));
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void DrawAirBombers(Graphics2D g)
|
|
||||||
{
|
|
||||||
int numOfObjectsInRow = _pictureWidth / _placeSizeWidth;
|
|
||||||
for (int i = 0; i < _setAirBombers.getCount(); i++)
|
|
||||||
{
|
|
||||||
if (_setAirBombers.Get(i) != null){
|
|
||||||
_setAirBombers.Get(i).SetObject((numOfObjectsInRow - (i % numOfObjectsInRow) - 1) * _placeSizeWidth, (i / numOfObjectsInRow) * _placeSizeHeight, _pictureWidth, _pictureHeight);
|
|
||||||
_setAirBombers.Get(i).DrawingObject(g);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,225 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.io.*;
|
|
||||||
import javax.swing.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class MapsCollection {
|
|
||||||
/// <summary>
|
|
||||||
/// Словарь (хранилище) с картами
|
|
||||||
/// </summary>
|
|
||||||
HashMap<String, MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap>> _mapStorages;
|
|
||||||
|
|
||||||
private String separatorDict = "-";
|
|
||||||
private String separatorData = ";";
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Возвращение списка названий карт
|
|
||||||
/// </summary>
|
|
||||||
public ArrayList<String> getKeys(){
|
|
||||||
ArrayList<String> keys = new ArrayList<>(_mapStorages.keySet());
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Ширина окна отрисовки
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureWidth;
|
|
||||||
/// <summary>
|
|
||||||
/// Высота окна отрисовки
|
|
||||||
/// </summary>
|
|
||||||
private int _pictureHeight;
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pictureWidth"></param>
|
|
||||||
/// <param name="pictureHeight"></param>
|
|
||||||
public MapsCollection(int pictureWidth, int pictureHeight)
|
|
||||||
{
|
|
||||||
_mapStorages = new HashMap<String, MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap>>();
|
|
||||||
_pictureWidth = pictureWidth;
|
|
||||||
_pictureHeight = pictureHeight;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление карты
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Название карты</param>
|
|
||||||
/// <param name="map">Карта</param>
|
|
||||||
public boolean AddMap(String name, AbstractMap map)
|
|
||||||
{
|
|
||||||
if (_mapStorages.containsKey(name))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
_mapStorages.put(name, new MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление карты
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="name">Название карты</param>
|
|
||||||
public void DelMap(String name)
|
|
||||||
{
|
|
||||||
if (_mapStorages.containsKey(name))
|
|
||||||
{
|
|
||||||
_mapStorages.remove(name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap> Get(String ind){
|
|
||||||
if (_mapStorages.containsKey(ind)) return _mapStorages.get(ind);
|
|
||||||
else return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean SaveData(String filename)
|
|
||||||
{
|
|
||||||
File saveFile = new File(filename);
|
|
||||||
if (saveFile.exists())
|
|
||||||
{
|
|
||||||
saveFile.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(saveFile));
|
|
||||||
bw.write("MapsCollection\n");
|
|
||||||
for (var storage : _mapStorages.keySet())
|
|
||||||
{
|
|
||||||
bw.write(storage + separatorDict + _mapStorages.get(storage).GetData(separatorDict, separatorData) + "\n");
|
|
||||||
}
|
|
||||||
bw.close();
|
|
||||||
}
|
|
||||||
catch (IOException ex){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Загрузка нформации по автомобилям на парковках из файла
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="filename"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public boolean LoadData(String filename)
|
|
||||||
{
|
|
||||||
File loadFile = new File(filename);
|
|
||||||
if (!loadFile.exists())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
try{
|
|
||||||
BufferedReader br = new BufferedReader(new FileReader(loadFile));
|
|
||||||
String line;
|
|
||||||
line = br.readLine();
|
|
||||||
line.trim();
|
|
||||||
if (!line.equals("MapsCollection")) return false;
|
|
||||||
_mapStorages.clear();
|
|
||||||
while ((line = br.readLine()) != null)
|
|
||||||
{
|
|
||||||
line = line.trim();
|
|
||||||
var elem = line.split(separatorDict);
|
|
||||||
AbstractMap map = null;
|
|
||||||
switch (elem[1])
|
|
||||||
{
|
|
||||||
case "SimpleMap":
|
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "CityMap":
|
|
||||||
map = new CityMap();
|
|
||||||
break;
|
|
||||||
case "LineMap":
|
|
||||||
map = new LineMap();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_mapStorages.put(elem[0], new MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
|
||||||
_mapStorages.get(elem[0]).LoadData(elem[2].split(separatorData));
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (IOException ex){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean SaveStorage(String filename, String storageKey)
|
|
||||||
{
|
|
||||||
File saveFile = new File(filename);
|
|
||||||
if (saveFile.exists())
|
|
||||||
{
|
|
||||||
saveFile.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
BufferedWriter bw = new BufferedWriter(new FileWriter(saveFile));
|
|
||||||
bw.write("Storage\n");
|
|
||||||
bw.write(storageKey + "\n");
|
|
||||||
String[] storageStrings = _mapStorages.get(storageKey).GetData(separatorDict, separatorData).split(separatorDict);
|
|
||||||
bw.write(storageStrings[0] + "\n");
|
|
||||||
String[] bombers = storageStrings[1].split(separatorData);
|
|
||||||
bw.write(bombers.length + "\n");
|
|
||||||
for (String bomber : bombers ){
|
|
||||||
bw.write(bomber + "\n");
|
|
||||||
}
|
|
||||||
bw.close();
|
|
||||||
}
|
|
||||||
catch (IOException ex){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean LoadStorage(String filename){
|
|
||||||
File loadFile = new File(filename);
|
|
||||||
if (!loadFile.exists())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
|
||||||
BufferedReader br = new BufferedReader(new FileReader(loadFile));
|
|
||||||
String line;
|
|
||||||
line = br.readLine();
|
|
||||||
line.trim();
|
|
||||||
if (!line.equals("Storage")) return false;
|
|
||||||
|
|
||||||
String key = br.readLine();
|
|
||||||
String mapType = br.readLine();
|
|
||||||
if (_mapStorages.containsKey(key)){
|
|
||||||
_mapStorages.get(key).clearStorage();
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
AbstractMap map = null;
|
|
||||||
switch (mapType)
|
|
||||||
{
|
|
||||||
case "SimpleMap":
|
|
||||||
map = new SimpleMap();
|
|
||||||
break;
|
|
||||||
case "CityMap":
|
|
||||||
map = new CityMap();
|
|
||||||
break;
|
|
||||||
case "LineMap":
|
|
||||||
map = new LineMap();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
_mapStorages.put(key, new MapWithSetAirBombersGeneric<IDrawingObject, AbstractMap>(_pictureWidth, _pictureHeight, map));
|
|
||||||
}
|
|
||||||
|
|
||||||
int numberOfBombers = Integer.parseInt( br.readLine());
|
|
||||||
for (int i =0; i< numberOfBombers;i++){
|
|
||||||
String bomber = br.readLine();
|
|
||||||
int res = _mapStorages.get(key).add(new DrawingObjectAirBomber(ExtentionAirBomber.ExtentionedAirBomber.CreateDrawningAirBomber(bomber)));
|
|
||||||
}
|
|
||||||
br.close();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (IOException ex){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,112 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class SetAirBombersGeneric<T> {
|
|
||||||
/// <summary>
|
|
||||||
/// Массив объектов, которые храним
|
|
||||||
/// </summary>
|
|
||||||
private ArrayList<T> _places;
|
|
||||||
/// <summary>
|
|
||||||
/// Количество объектов в массиве
|
|
||||||
/// </summary>
|
|
||||||
private int _maxCount;
|
|
||||||
/// <summary>
|
|
||||||
/// Конструктор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="count"></param>
|
|
||||||
public SetAirBombersGeneric(int count)
|
|
||||||
{
|
|
||||||
_places = new ArrayList<T>(count);
|
|
||||||
_maxCount = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCount(){
|
|
||||||
return _places.size();
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в набор
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="airBomber">Добавляемый автомобиль</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Insert(T airBomber)
|
|
||||||
{
|
|
||||||
return Insert(airBomber, 0);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление объекта в набор на конкретную позицию
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="airBomber">Добавляемый автомобиль</param>
|
|
||||||
/// <param name="position">Позиция</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int Insert(T airBomber, int position)
|
|
||||||
{
|
|
||||||
if (position < 0 || position >= _maxCount)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
_places.add(position, airBomber);
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Удаление объекта из набора с конкретной позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public T Remove(int position)
|
|
||||||
{
|
|
||||||
if (position <0 || position >= _maxCount)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
T removedObject = _places.get(position);
|
|
||||||
_places.remove(position);
|
|
||||||
return removedObject;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// Получение объекта из набора по позиции
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="position"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public T Get(int position)
|
|
||||||
{
|
|
||||||
if (position >= _maxCount || position < 0)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return _places.get(position);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Set(int position, T value){
|
|
||||||
if (position >= _maxCount || position < 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_places.set(position, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<T> GetAirBombers(){
|
|
||||||
ArrayList<T> notNullAirBombers = new ArrayList<>();
|
|
||||||
for(var airBomber : _places){
|
|
||||||
if (airBomber != null){
|
|
||||||
notNullAirBombers.add(airBomber);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return notNullAirBombers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear(){
|
|
||||||
_places.clear();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,99 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.util.Random;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class SetAirBombersGenericDop<T extends EntityAirBomber, U extends IDrawingObjectDop> {
|
|
||||||
private Object[] _bases;
|
|
||||||
private Object[] _engines;
|
|
||||||
private int Count;
|
|
||||||
|
|
||||||
public SetAirBombersGenericDop(int count){
|
|
||||||
_bases = new Object[count];
|
|
||||||
_engines = new Object[count];
|
|
||||||
Count = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int add(T base){
|
|
||||||
return add(base, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int add(T base, int position){
|
|
||||||
if (position >= _bases.length)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (_bases[position] != null)
|
|
||||||
{
|
|
||||||
int indexNull = -1;
|
|
||||||
for (int i = position; i < _bases.length; i++)
|
|
||||||
{
|
|
||||||
if (_bases[i] == null)
|
|
||||||
{
|
|
||||||
indexNull = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (indexNull == -1) return -1;
|
|
||||||
for (int i = indexNull; i > position; i--)
|
|
||||||
{
|
|
||||||
T tmp = (T) _bases[i];
|
|
||||||
_bases[i] = _bases[i - 1];
|
|
||||||
_bases[i - 1] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_bases[position] = base;
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int add(U engine){
|
|
||||||
return add(engine, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int add(U engine, int position){
|
|
||||||
if (position >= _engines.length)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (_engines[position] != null)
|
|
||||||
{
|
|
||||||
int indexNull = -1;
|
|
||||||
for (int i = position; i < _engines.length; i++)
|
|
||||||
{
|
|
||||||
if (_engines[i] == null)
|
|
||||||
{
|
|
||||||
indexNull = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (indexNull == -1) return -1;
|
|
||||||
for (int i = indexNull; i > position; i--)
|
|
||||||
{
|
|
||||||
U tmp = (U) _engines[i];
|
|
||||||
_engines[i] = _engines[i - 1];
|
|
||||||
_engines[i - 1] = tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_engines[position] = engine;
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public DrawingAirBomber buildAirBomber(){
|
|
||||||
Random rnd = new Random();
|
|
||||||
int baseIndex = rnd.nextInt(0, _bases.length);
|
|
||||||
int engineIndex = rnd.nextInt(0, _engines.length);
|
|
||||||
EnginesType enginesType;
|
|
||||||
T selectedBase = (T) _bases[baseIndex];
|
|
||||||
U selectedEngines = (U) _engines[engineIndex];
|
|
||||||
if (selectedEngines instanceof DrawingEngines) enginesType = EnginesType.RECTANGLE;
|
|
||||||
else if (selectedEngines instanceof DrawingEnginesTriangle) enginesType = EnginesType.TRIANGLE;
|
|
||||||
else enginesType = EnginesType.OVAL;
|
|
||||||
return new DrawingAirBomber(selectedBase.getSpeed(), selectedBase.getWeight(), selectedBase.getBodyColor(), selectedEngines.getNumberOfEngines(), enginesType);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
/*
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
|
||||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
|
||||||
*/
|
|
||||||
package AirBomberPackage;
|
|
||||||
import java.awt.*;
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Андрей
|
|
||||||
*/
|
|
||||||
public class SimpleMap extends AbstractMap {
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка закрытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color barrierColor = Color.BLACK;
|
|
||||||
/// <summary>
|
|
||||||
/// Цвет участка открытого
|
|
||||||
/// </summary>
|
|
||||||
private final Color roadColor = Color.GRAY;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void DrawBarrierPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(barrierColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void DrawRoadPart(Graphics g, int i, int j)
|
|
||||||
{
|
|
||||||
g.setColor(roadColor);
|
|
||||||
g.fillRect(i * _size_x, j * _size_y, _size_x, _size_y);
|
|
||||||
g.setColor(Color.BLACK);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
protected void GenerateMap()
|
|
||||||
{
|
|
||||||
_map = new int[100][100];
|
|
||||||
_size_x = _width / _map.length;
|
|
||||||
_size_y = _height / _map[0].length;
|
|
||||||
int counter = 0;
|
|
||||||
for (int i = 0; i < _map.length; ++i)
|
|
||||||
{
|
|
||||||
for (int j = 0; j < _map[0].length; ++j)
|
|
||||||
{
|
|
||||||
_map[i][j] = _freeRoad;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (counter < 50)
|
|
||||||
{
|
|
||||||
int x = _random.nextInt(0, 100);
|
|
||||||
int y = _random.nextInt(0, 100);
|
|
||||||
if (_map[x][y] == _freeRoad)
|
|
||||||
{
|
|
||||||
_map[x][y] = _barrier;
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Binary file not shown.
Before Width: | Height: | Size: 565 B |
Binary file not shown.
Before Width: | Height: | Size: 612 B |
Binary file not shown.
Before Width: | Height: | Size: 619 B |
Binary file not shown.
Before Width: | Height: | Size: 546 B |
Loading…
Reference in New Issue
Block a user