Настройка отображения хранилища и выбранной карты, а также объектов в хранилище.
This commit is contained in:
parent
571b302e4b
commit
3818ea591b
@ -135,20 +135,15 @@ public class DrawingPlane extends JPanel
|
||||
|
||||
Graphics2D g2d = (Graphics2D)g;
|
||||
|
||||
//корпус
|
||||
//заливка корпуса
|
||||
g2d.setColor(Plane.GetColor());
|
||||
g2d.fillRect((int)_startPosX, (int)_startPosY + 10, 40, 10);
|
||||
|
||||
//заливает фигуру
|
||||
g2d.setPaint(Color.BLACK);
|
||||
|
||||
//крыло
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.fillRect((int)_startPosX + 10, (int)_startPosY + 15, 20, 2);
|
||||
g2d.fillRect((int)_startPosX + 12, (int)_startPosY + 17, 16, 2);
|
||||
|
||||
//заднее поперечное крыло
|
||||
g2d.fillOval((int)_startPosX - 3, (int)_startPosY + 7, 10, 5);
|
||||
|
||||
//задние шасси
|
||||
g2d.fillRect((int)_startPosX + 10, (int)_startPosY + 21, 2, 2);
|
||||
g2d.fillRect((int)_startPosX + 12, (int)_startPosY + 23, 4, 4);
|
||||
@ -158,15 +153,37 @@ public class DrawingPlane extends JPanel
|
||||
g2d.fillRect((int)_startPosX + 35, (int)_startPosY + 21, 2, 2);
|
||||
g2d.fillRect((int)_startPosX + 35, (int)_startPosY + 23, 4, 4);
|
||||
|
||||
//хвостовое крыло
|
||||
//заливка хвостового крыла
|
||||
g2d.setColor(Plane.GetColor());
|
||||
int[] xCoordFirst = {(int)_startPosX, (int)_startPosX, (int)_startPosX + 10};
|
||||
int[] yCoordFirst = {(int)_startPosY + 10, (int)_startPosY, (int)_startPosY + 10};
|
||||
g2d.fillPolygon(xCoordFirst, yCoordFirst, xCoordFirst.length);
|
||||
|
||||
//заливка носа самолёта
|
||||
int[] xCoordSecond = {(int)_startPosX + 40, (int)_startPosX + 47, (int)_startPosX + 40};
|
||||
int[] yCoordSecond = {(int)_startPosY + 15, (int)_startPosY + 15, (int)_startPosY + 10};
|
||||
g2d.fillPolygon(xCoordSecond, yCoordSecond, xCoordSecond.length);
|
||||
|
||||
int[] xCoordThird = {(int)_startPosX + 40, (int)_startPosX + 50, (int)_startPosX + 40};
|
||||
int[] yCoordThird = {(int)_startPosY + 15, (int)_startPosY + 15, (int)_startPosY + 20};
|
||||
g2d.fillPolygon(xCoordThird, yCoordThird, xCoordThird.length);
|
||||
|
||||
//контур хвостового крыла
|
||||
g2d.setColor(Color.BLACK);
|
||||
g2d.drawLine((int)_startPosX, (int)_startPosY + 10, (int)_startPosX, (int)_startPosY);
|
||||
g2d.drawLine((int)_startPosX, (int)_startPosY, (int)_startPosX + 10, (int)_startPosY + 10);
|
||||
|
||||
//нос самолёта
|
||||
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 15, (int)_startPosX + 50, (int)_startPosY + 16);
|
||||
//отрисовка контура самолёта
|
||||
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 15, (int)_startPosX + 50, (int)_startPosY + 15);
|
||||
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 10, (int)_startPosX + 47, (int)_startPosY + 15);
|
||||
g2d.drawLine((int)_startPosX + 40, (int)_startPosY + 20, (int)_startPosX + 50, (int)_startPosY + 15);
|
||||
|
||||
//контур корпуса
|
||||
g2d.drawRect((int)_startPosX, (int)_startPosY + 10, 40, 10);
|
||||
|
||||
//заднее поперечное крыло
|
||||
g2d.fillOval((int)_startPosX - 3, (int)_startPosY + 7, 10, 5);
|
||||
|
||||
//отрисовка иллюминаторов
|
||||
_airplaneWindow.DrawAirplaneWindow(Plane.GetColor(), g, _startPosX, _startPosY);
|
||||
}
|
||||
|
@ -1,127 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="FormMap">
|
||||
<grid id="27dc6" binding="MainPanel" layout-manager="GridLayoutManager" row-count="4" column-count="8" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="796" height="519"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<toolbar id="cf96b" binding="StatusStrip">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="-1" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</toolbar>
|
||||
<component id="34e5f" class="javax.swing.JButton" binding="ButtonCreate">
|
||||
<constraints>
|
||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Создать"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="5d8c4" class="javax.swing.JButton" binding="ButtonCreateModif">
|
||||
<constraints>
|
||||
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalAlignment value="0"/>
|
||||
<text value="Модифицировать"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="150e1">
|
||||
<constraints>
|
||||
<grid row="3" column="4" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="dfc6f" class="javax.swing.JButton" binding="ButtonLeft">
|
||||
<constraints>
|
||||
<grid row="3" column="5" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="45" height="45"/>
|
||||
<preferred-size width="45" height="45"/>
|
||||
<maximum-size width="45" height="45"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<horizontalTextPosition value="0"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="aa961" class="javax.swing.JButton" binding="ButtonDown">
|
||||
<constraints>
|
||||
<grid row="3" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="45" height="45"/>
|
||||
<preferred-size width="45" height="45"/>
|
||||
<maximum-size width="45" height="45"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ab8aa" class="javax.swing.JButton" binding="ButtonRight">
|
||||
<constraints>
|
||||
<grid row="3" column="7" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="45" height="45"/>
|
||||
<preferred-size width="45" height="45"/>
|
||||
<maximum-size width="45" height="45"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="2b365" class="javax.swing.JButton" binding="ButtonUp">
|
||||
<constraints>
|
||||
<grid row="2" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="45" height="45"/>
|
||||
<preferred-size width="45" height="45"/>
|
||||
<maximum-size width="45" height="45"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="c63c0" binding="PictureBoxPlane" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="8" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<foreground color="-4473925"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children/>
|
||||
</grid>
|
||||
<component id="ae3f0" class="javax.swing.JComboBox" binding="ComboBoxSelectorMap">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<model>
|
||||
<item value="Простая карта"/>
|
||||
<item value="Буря в пустыне"/>
|
||||
<item value="Звёздные войны"/>
|
||||
</model>
|
||||
<toolTipText value="" noi18n="true"/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="ac18c">
|
||||
<constraints>
|
||||
<grid row="0" column="2" row-span="1" col-span="6" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<hspacer id="43771">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
@ -1,201 +0,0 @@
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Random;
|
||||
|
||||
public class FormMap extends JFrame
|
||||
{
|
||||
public JPanel MainPanel;
|
||||
private JButton ButtonCreate;
|
||||
private JButton ButtonCreateModif;
|
||||
private JButton ButtonLeft;
|
||||
private JButton ButtonDown;
|
||||
private JButton ButtonRight;
|
||||
private JButton ButtonUp;
|
||||
private JToolBar StatusStrip;
|
||||
private JPanel PictureBoxPlane;
|
||||
private JComboBox ComboBoxSelectorMap;
|
||||
private JLabel LabelSpeed = new JLabel();
|
||||
private JLabel LabelWeight = new JLabel();
|
||||
private JLabel LabelColor = new JLabel();
|
||||
|
||||
protected DrawingPlane _plane;
|
||||
private AbstractMap _abstractMap;
|
||||
private Random rnd = new Random();
|
||||
private BufferedImage bufferImg = null;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
if (bufferImg == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PictureBoxPlane.getGraphics().drawImage(bufferImg, 0, 0, PictureBoxPlane.getWidth(), PictureBoxPlane.getHeight(), null);
|
||||
}
|
||||
|
||||
public void SetData(DrawingPlane _plane)
|
||||
{
|
||||
PictureBoxPlane.removeAll();
|
||||
|
||||
LabelSpeed.setText("Скорость: " + _plane.GetPlane().GetSpeed() + " ");
|
||||
LabelWeight.setText("Вес: " + _plane.GetPlane().GetWeight() + " ");
|
||||
LabelColor.setText("Цвет: r = " + _plane.GetPlane().GetColor().getRed() + " g = " + _plane.GetPlane().GetColor().getGreen() +
|
||||
" b = " + _plane.GetPlane().GetColor().getBlue());
|
||||
|
||||
if (_abstractMap != null)
|
||||
{
|
||||
bufferImg = _abstractMap.CreateMap(PictureBoxPlane.getWidth(),
|
||||
PictureBoxPlane.getHeight(), new DrawningObjectPlane(_plane));
|
||||
}
|
||||
|
||||
PictureBoxPlane.revalidate();
|
||||
}
|
||||
|
||||
public FormMap()
|
||||
{
|
||||
_abstractMap = new SimpleMap();
|
||||
|
||||
//создание строки отображения скорости, веса и цвета объекта
|
||||
Box LableBox = Box.createHorizontalBox();
|
||||
LableBox.setMinimumSize(new Dimension(1, 20));
|
||||
LableBox.add(LabelSpeed);
|
||||
LableBox.add(LabelWeight);
|
||||
LableBox.add(LabelColor);
|
||||
StatusStrip.add(LableBox);
|
||||
|
||||
try
|
||||
{
|
||||
Image img = ImageIO.read(getClass().getResource("resourses/Up.png"));
|
||||
ButtonUp.setIcon(new ImageIcon(img));
|
||||
img = ImageIO.read(getClass().getResource("resourses/Left.png"));
|
||||
ButtonLeft.setIcon(new ImageIcon(img));
|
||||
img = ImageIO.read(getClass().getResource("resourses/Down.png"));
|
||||
ButtonDown.setIcon(new ImageIcon(img));
|
||||
img = ImageIO.read(getClass().getResource("resourses/Right.png"));
|
||||
ButtonRight.setIcon(new ImageIcon(img));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
|
||||
ButtonCreate.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Random rnd = new Random();
|
||||
var plane = new DrawingPlane(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
||||
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)));
|
||||
plane.SetPosition(rnd.nextInt(10, 100), rnd.nextInt(10, 100),
|
||||
PictureBoxPlane.getWidth(), PictureBoxPlane.getHeight());
|
||||
SetData(plane);
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonUp.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PictureBoxPlane.removeAll();
|
||||
|
||||
JLabel imageWithMapAndObject = new JLabel();
|
||||
imageWithMapAndObject.setPreferredSize(PictureBoxPlane.getSize());
|
||||
imageWithMapAndObject.setMinimumSize(new Dimension(1, 1));
|
||||
imageWithMapAndObject.setIcon(new ImageIcon(_abstractMap.MoveObject((Direction.Up))));
|
||||
|
||||
PictureBoxPlane.add(imageWithMapAndObject, BorderLayout.CENTER);
|
||||
PictureBoxPlane.revalidate();
|
||||
PictureBoxPlane.repaint();
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonLeft.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PictureBoxPlane.removeAll();
|
||||
|
||||
JLabel imageWithMapAndObject = new JLabel();
|
||||
imageWithMapAndObject.setPreferredSize(PictureBoxPlane.getSize());
|
||||
imageWithMapAndObject.setMinimumSize(new Dimension(1, 1));
|
||||
imageWithMapAndObject.setIcon(new ImageIcon(_abstractMap.MoveObject((Direction.Left))));
|
||||
|
||||
PictureBoxPlane.add(imageWithMapAndObject, BorderLayout.CENTER);
|
||||
PictureBoxPlane.revalidate();
|
||||
PictureBoxPlane.repaint();
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonDown.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PictureBoxPlane.removeAll();
|
||||
|
||||
JLabel imageWithMapAndObject = new JLabel();
|
||||
imageWithMapAndObject.setPreferredSize(PictureBoxPlane.getSize());
|
||||
imageWithMapAndObject.setMinimumSize(new Dimension(1, 1));
|
||||
imageWithMapAndObject.setIcon(new ImageIcon(_abstractMap.MoveObject((Direction.Down))));
|
||||
|
||||
PictureBoxPlane.add(imageWithMapAndObject, BorderLayout.CENTER);
|
||||
PictureBoxPlane.revalidate();
|
||||
PictureBoxPlane.repaint();
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonRight.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PictureBoxPlane.removeAll();
|
||||
|
||||
JLabel imageWithMapAndObject = new JLabel();
|
||||
imageWithMapAndObject.setPreferredSize(PictureBoxPlane.getSize());
|
||||
imageWithMapAndObject.setMinimumSize(new Dimension(1, 1));
|
||||
imageWithMapAndObject.setIcon(new ImageIcon(_abstractMap.MoveObject((Direction.Right))));
|
||||
|
||||
PictureBoxPlane.add(imageWithMapAndObject, BorderLayout.CENTER);
|
||||
PictureBoxPlane.revalidate();
|
||||
PictureBoxPlane.repaint();
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonCreateModif.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
_plane = new DrawingAirbus(rnd.nextInt(100, 300), rnd.nextInt(1000, 2000),
|
||||
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||
new Color(rnd.nextInt(256), rnd.nextInt(256), rnd.nextInt(256)),
|
||||
rnd.nextBoolean(), rnd.nextBoolean());
|
||||
_plane.SetPosition(rnd.nextInt(100, 500), rnd.nextInt(10, 100),
|
||||
PictureBoxPlane.getWidth(), PictureBoxPlane.getHeight());
|
||||
SetData(_plane);
|
||||
Draw();
|
||||
}
|
||||
});
|
||||
|
||||
ComboBoxSelectorMap.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ComboBoxSelectorMap = (JComboBox)e.getSource();
|
||||
String item = (String)ComboBoxSelectorMap.getSelectedItem();
|
||||
switch(item)
|
||||
{
|
||||
case "Простая карта":
|
||||
_abstractMap = new SimpleMap();
|
||||
break;
|
||||
case "Буря в пустыне":
|
||||
_abstractMap = new DesertStormMap();
|
||||
break;
|
||||
case "Звёздные войны":
|
||||
_abstractMap = new StarWarsMap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
@ -8,8 +8,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="92d87" binding="PictureBoxPlane" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<grid id="92d87" binding="PictureBoxPlane" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="730" height="550"/>
|
||||
@ -143,7 +142,7 @@
|
||||
</constraints>
|
||||
<properties>
|
||||
<columns value="2"/>
|
||||
<text value="__"/>
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d75e9" class="javax.swing.JButton" binding="ButtonRemovePlane">
|
||||
|
@ -8,7 +8,7 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public class FormMapWithSetPlanesGeneric {
|
||||
private JPanel MainPanel;
|
||||
public JPanel MainPanel;
|
||||
private JPanel PictureBoxPlane;
|
||||
private JPanel ButtonGroupPanel;
|
||||
private JComboBox ComboBoxSelectorMap;
|
||||
@ -66,7 +66,7 @@ public class FormMapWithSetPlanesGeneric {
|
||||
}
|
||||
|
||||
FormPlane form = new FormPlane();
|
||||
form.setSize(1000,700);
|
||||
form.setSize(700,400);
|
||||
form.setVisible(true);
|
||||
form.setModal(true);
|
||||
DrawningObjectPlane plane = new DrawningObjectPlane(form.GetSelectedShip());
|
||||
@ -135,7 +135,7 @@ public class FormMapWithSetPlanesGeneric {
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateWindow(_mapPlanesCollectionGeneric.ShowSet());
|
||||
UpdateWindow(_mapPlanesCollectionGeneric.ShowOnMap());
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -34,15 +34,6 @@
|
||||
<text value=""/>
|
||||
</properties>
|
||||
</component>
|
||||
<hspacer id="5b756">
|
||||
<constraints>
|
||||
<grid row="2" column="6" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="50" height="-1"/>
|
||||
<preferred-size width="50" height="-1"/>
|
||||
<maximum-size width="50" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="a48b0" class="javax.swing.JButton" binding="ButtonCreate">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
@ -91,7 +82,7 @@
|
||||
</component>
|
||||
<component id="96587" class="javax.swing.JButton" binding="ButtonCreateModif">
|
||||
<constraints>
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false">
|
||||
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="120" height="30"/>
|
||||
<preferred-size width="120" height="30"/>
|
||||
<maximum-size width="120" height="30"/>
|
||||
|
@ -5,11 +5,11 @@ public class Main
|
||||
public static void main(String[] args)
|
||||
{
|
||||
JFrame frame = new JFrame("Airbus");
|
||||
frame.setContentPane(new FormMap().MainPanel);
|
||||
frame.setContentPane(new FormMapWithSetPlanesGeneric().MainPanel);
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setLocation(500, 200);
|
||||
frame.pack();
|
||||
frame.setSize(1000, 500);
|
||||
frame.setSize(1000, 600);
|
||||
frame.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
@ -121,10 +121,12 @@ public class MapWithSetPlanesGeneric <T extends IDrawningObject, U extends Abstr
|
||||
|
||||
g2d.setStroke(new BasicStroke(3));
|
||||
g2d.setColor(Color.BLACK);
|
||||
|
||||
for(int i = 0; i < _pictureWidth / _placeSizeWidth - 1; i++)
|
||||
{
|
||||
//линия разметки места
|
||||
for(int j = 2; j < _pictureHeight / _placeSizeHeight + 1; ++j)
|
||||
{//линия разметки места
|
||||
{
|
||||
g2d.drawLine(i * _placeSizeWidth + 5, j * _placeSizeHeight, i * _placeSizeWidth + _placeSizeWidth / 2 + 5, j * _placeSizeHeight);
|
||||
}
|
||||
|
||||
@ -182,8 +184,11 @@ public class MapWithSetPlanesGeneric <T extends IDrawningObject, U extends Abstr
|
||||
|
||||
for (int i = 0; i < _setPlanes.Count(); i++)
|
||||
{
|
||||
_setPlanes.Get(i).SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight);
|
||||
_setPlanes.Get(i).DrawningObject(g);
|
||||
if(_setPlanes.Get(i) != null)
|
||||
{
|
||||
_setPlanes.Get(i).SetObject(currentWidth * _placeSizeWidth + 20, currentHeight * _placeSizeHeight + 20, _pictureWidth, _pictureHeight);
|
||||
_setPlanes.Get(i).DrawningObject(g);
|
||||
}
|
||||
|
||||
if(position % 2 == 0)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user