This commit is contained in:
Кашин Максим 2022-10-22 16:15:59 +04:00
parent 14f32cb3f7
commit f4524f8624
8 changed files with 8 additions and 8 deletions

BIN
Material/KeyDown.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 808 B

BIN
Material/KeyDown.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
Material/KeyLeft.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
Material/KeyRight.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
Material/KeyUp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -25,13 +25,13 @@ public class DrawingField extends JPanel{
private void SetData() { private void SetData() {
Random rand=new Random(); Random rand=new Random();
_gasolineTanker.SetPosition(rand.nextInt(100)+10,rand.nextInt(100)+10,getWidth(),getHeight()); _gasolineTanker.SetPosition(rand.nextInt(100)+10,rand.nextInt(100)+10,getWidth(),getHeight());
Field.SpeedLabel.setText("Скорость: "+_gasolineTanker.getGasolineTanker().getSpeed()); Field.SpeedLabel.setText("Speed: "+_gasolineTanker.getGasolineTanker().getSpeed());
Field.WeightLabel.setText("Вес: "+_gasolineTanker.getGasolineTanker().getWeight()); Field.WeightLabel.setText("Weight: "+_gasolineTanker.getGasolineTanker().getWeight());
Field.BodyColorLabel.setText("Цвет: "+Integer.toHexString(_gasolineTanker.getGasolineTanker().getBodyColor().getRGB()).substring(2)); Field.BodyColorLabel.setText("Color: "+Integer.toHexString(_gasolineTanker.getGasolineTanker().getBodyColor().getRGB()).substring(2));
} }
public void CreateButtonAction(){ public void CreateButtonAction(){
Random rand=new Random(); Random rand=new Random();
Color color1 = JColorChooser.showDialog(Field, "Выберите цвет тела корабля", null); Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
if(color1==null) if(color1==null)
color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
_gasolineTanker=new DrawingGasolineTanker(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3)); _gasolineTanker=new DrawingGasolineTanker(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3));
@ -39,8 +39,8 @@ public class DrawingField extends JPanel{
} }
public void CreateModifButtonAction(){ public void CreateModifButtonAction(){
Random rand=new Random(); Random rand=new Random();
Color color1=JColorChooser.showDialog(Field, "Выберите цвет тела корабля",null); Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
Color color2=JColorChooser.showDialog(Field, "Выборите цвет модификаций корабля",null); Color color2=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
if(color1==null) if(color1==null)
color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256));
if (color2==null) if (color2==null)

View File

@ -19,7 +19,7 @@ public class FormGasolineTanker extends JFrame{
private JPanel PictureBox; private JPanel PictureBox;
public FormGasolineTanker(){ public FormGasolineTanker(){
super("Военный корабль"); super("Gasoline Tanker");
setContentPane(PictureBox); setContentPane(PictureBox);
setSize(1000,700); setSize(1000,700);
Width = getWidth(); Width = getWidth();

View File

@ -30,7 +30,7 @@ public class FormMap extends JFrame {
ImageIcon spriteRight =new ImageIcon((new ImageIcon("Material\\KeyRight.png")). ImageIcon spriteRight =new ImageIcon((new ImageIcon("Material\\KeyRight.png")).
getImage().getScaledInstance(10,10,Image.SCALE_SMOOTH)); getImage().getScaledInstance(10,10,Image.SCALE_SMOOTH));
public FormMap(){ public FormMap(){
super("Военный корабль"); super("Gasoline tanker");
setContentPane(PictureBox); setContentPane(PictureBox);
setSize(1000,700); setSize(1000,700);
Width = getWidth(); Width = getWidth();