Третий коммит. Убран jcolorchooser

This commit is contained in:
AnnZhimol 2022-10-19 09:53:20 +04:00
parent 13eaeb49ed
commit a2e5535386
2 changed files with 6 additions and 21 deletions

View File

@ -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(){

View File

@ -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);