diff --git a/src/DrawingField.java b/src/DrawingField.java index b46e965..4569581 100644 --- a/src/DrawingField.java +++ b/src/DrawingField.java @@ -31,22 +31,13 @@ public class DrawingField extends JPanel{ } public void CreateButtonAction(){ Random rand=new Random(); - Color color1 = JColorChooser.showDialog(Field, "Выберите цвет тела корабля", null); - if(color1==null) - color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); - _warship=new DrawingWarship(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3)); + _warship=new DrawingWarship(rand.nextInt(50)+10,rand.nextInt(3000)+20000,new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)),rand.nextInt(3)); SetData(); } public void CreateModifButtonAction(){ Random rand=new Random(); - Color color1=JColorChooser.showDialog(Field, "Выберите цвет тела корабля",null); - Color color2=JColorChooser.showDialog(Field, "Выборите цвет модификаций корабля",null); - if(color1==null) - color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); - if (color2==null) - color2=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); - _warship = new DrawingAdvancedWarship(rand.nextInt(50) + 10, rand.nextInt(3000) + 20000, color1, - color2, rand.nextBoolean(), rand.nextBoolean(), rand.nextBoolean(),rand.nextInt(3)); + _warship = new DrawingAdvancedWarship(rand.nextInt(50) + 10, rand.nextInt(3000) + 20000, new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)), + new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)), rand.nextBoolean(), rand.nextBoolean(), rand.nextBoolean(),rand.nextInt(3)); SetData(); } public void ResizeField(){ diff --git a/src/DrawingMap.java b/src/DrawingMap.java index 36ae792..150c1c9 100644 --- a/src/DrawingMap.java +++ b/src/DrawingMap.java @@ -29,20 +29,14 @@ public class DrawingMap extends JPanel { } public void CreateButtonAction(){ Random rand=new Random(); - Color color1 = JColorChooser.showDialog(Map, "Выберите цвет тела корабля", null); - if(color1==null) - color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); + Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); DrawingWarship warship=new DrawingWarship(rand.nextInt(50)+10,rand.nextInt(3000)+20000,color1,rand.nextInt(3)); SetData(warship); } public void CreateModifButtonAction(){ Random rand=new Random(); - Color color1=JColorChooser.showDialog(Map, "Выберите цвет тела корабля",null); - Color color2=JColorChooser.showDialog(Map, "Выборите цвет модификаций корабля",null); - if(color1==null) - color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); - if (color2==null) - color2=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); + Color color1=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); + Color color2=new Color(rand.nextInt(256), rand.nextInt(256), rand.nextInt(256)); DrawingWarship warship = new DrawingAdvancedWarship(rand.nextInt(50) + 10, rand.nextInt(3000) + 20000, color1, color2, rand.nextBoolean(), rand.nextBoolean(), rand.nextBoolean(),rand.nextInt(3)); SetData(warship);