|
|
@ -17,8 +17,8 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
Button lila = new Button ("Lila", 16, this);
|
|
|
|
Button lila = new Button ("Lila", 16, this);
|
|
|
|
Button gelb = new Button ("Gelb", 16, this);
|
|
|
|
Button gelb = new Button ("Gelb", 16, this);
|
|
|
|
Button weiter = new Button ("Weiter", 16, this);
|
|
|
|
Button weiter = new Button ("Weiter", 16, this);
|
|
|
|
int[] color = new int [6];
|
|
|
|
int[] color = new int [5];
|
|
|
|
String[] pn = new String [6];
|
|
|
|
String[] pn = new String [5];
|
|
|
|
int x = 0;
|
|
|
|
int x = 0;
|
|
|
|
boolean possw = true; // schwarz
|
|
|
|
boolean possw = true; // schwarz
|
|
|
|
boolean posbl = true; // blau
|
|
|
|
boolean posbl = true; // blau
|
|
|
@ -40,7 +40,6 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
Label pl3 = new Label("",16);
|
|
|
|
Label pl3 = new Label("",16);
|
|
|
|
Label pl4 = new Label("",16);
|
|
|
|
Label pl4 = new Label("",16);
|
|
|
|
Label pl5 = new Label("",16);
|
|
|
|
Label pl5 = new Label("",16);
|
|
|
|
Label pl6 = new Label("",16);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Constructor for objects of class Colors.
|
|
|
|
* Constructor for objects of class Colors.
|
|
|
@ -52,7 +51,7 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
setBackground(Start_Load.backgroundImage);
|
|
|
|
setBackground(Start_Load.backgroundImage);
|
|
|
|
|
|
|
|
|
|
|
|
Button[] bList = new Button[] {schwarz,gelb,blau,grün,rot,lila,weiter,remove};
|
|
|
|
Button[] bList = new Button[] {schwarz,gelb,blau,grün,rot,lila,weiter,remove};
|
|
|
|
Label[] lList = new Label[] {header,pl1,pl2,pl3,pl4,pl5,pl6};
|
|
|
|
Label[] lList = new Label[] {header,pl1,pl2,pl3,pl4,pl5};
|
|
|
|
|
|
|
|
|
|
|
|
addObject(header,200,15);
|
|
|
|
addObject(header,200,15);
|
|
|
|
|
|
|
|
|
|
|
@ -70,7 +69,6 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
addObject(pl3,355,200);
|
|
|
|
addObject(pl3,355,200);
|
|
|
|
addObject(pl4,355,220);
|
|
|
|
addObject(pl4,355,220);
|
|
|
|
addObject(pl5,355,240);
|
|
|
|
addObject(pl5,355,240);
|
|
|
|
addObject(pl6,355,260);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
schwarz.setForeColor(Color.black);
|
|
|
|
schwarz.setForeColor(Color.black);
|
|
|
|
gelb.setForeColor(Color.yellow);
|
|
|
|
gelb.setForeColor(Color.yellow);
|
|
|
@ -98,53 +96,43 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
//der per Konstruktor die Daten der Colorklasse übertragen werden, dannach wird die Map die aktive Welt
|
|
|
|
//der per Konstruktor die Daten der Colorklasse übertragen werden, dannach wird die Map die aktive Welt
|
|
|
|
public void buttonClicked (Button b)
|
|
|
|
public void buttonClicked (Button b)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( b == schwarz && possw == true)
|
|
|
|
if (x < 5) {
|
|
|
|
{
|
|
|
|
if (b == schwarz && possw == true) {
|
|
|
|
color[x] = sw;
|
|
|
|
color[x] = sw;
|
|
|
|
pn[x]=getName(x,"Schwarz");
|
|
|
|
pn[x]=getName(x,"Schwarz");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
x+=1;
|
|
|
|
x+=1;
|
|
|
|
possw = false;
|
|
|
|
possw = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (b == blau && posbl == true) {
|
|
|
|
if (b == blau && posbl == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color[x] = bl;
|
|
|
|
color[x] = bl;
|
|
|
|
pn[x]=getName(x,"Blau");
|
|
|
|
pn[x]=getName(x,"Blau");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
x+=1;
|
|
|
|
x+=1;
|
|
|
|
posbl = false;
|
|
|
|
posbl = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (b == grün && posgr == true ) {
|
|
|
|
if (b == grün && posgr == true )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color[x] = gr;
|
|
|
|
color[x] = gr;
|
|
|
|
pn[x]=getName(x,"Grün");
|
|
|
|
pn[x]=getName(x,"Grün");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
x+=1;
|
|
|
|
x+=1;
|
|
|
|
posgr = false;
|
|
|
|
posgr = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (b == rot && posrt == true) {
|
|
|
|
if ( b == rot && posrt == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color[x] = rt;
|
|
|
|
color[x] = rt;
|
|
|
|
pn[x]=getName(x,"Rot");
|
|
|
|
pn[x]=getName(x,"Rot");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
x+=1;
|
|
|
|
x+=1;
|
|
|
|
posrt = false;
|
|
|
|
posrt = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (b == gelb && posgb == true) {
|
|
|
|
if ( b == gelb && posgb == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color [x] = gb;
|
|
|
|
color [x] = gb;
|
|
|
|
pn[x]=getName(x,"Gelb");
|
|
|
|
pn[x]=getName(x,"Gelb");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
x+=1;
|
|
|
|
x+=1;
|
|
|
|
posgb = false;
|
|
|
|
posgb = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (b == lila && posli == true) {
|
|
|
|
if ( b == lila && posli == true)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
color [x] = li;
|
|
|
|
color [x] = li;
|
|
|
|
pn[x]=getName(x,"Lila");
|
|
|
|
pn[x]=getName(x,"Lila");
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
|
if(pn[x].length() > 0) {
|
|
|
@ -152,6 +140,7 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
posli = false;
|
|
|
|
posli = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if(b == remove && x > 0) {
|
|
|
|
if(b == remove && x > 0) {
|
|
|
|
x -= 1;
|
|
|
|
x -= 1;
|
|
|
|
switch(color[x]) {
|
|
|
|
switch(color[x]) {
|
|
|
@ -179,6 +168,9 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Color getC(boolean pos) {
|
|
|
|
private Color getC(boolean pos) {
|
|
|
|
|
|
|
|
if(x >= 5) {
|
|
|
|
|
|
|
|
return Color.gray;
|
|
|
|
|
|
|
|
}
|
|
|
|
return (pos) ? Color.lightGray : Color.gray;
|
|
|
|
return (pos) ? Color.lightGray : Color.gray;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -193,15 +185,13 @@ public class Colours extends World implements ButtonEvent
|
|
|
|
lila.setBackColor(getC(posli));
|
|
|
|
lila.setBackColor(getC(posli));
|
|
|
|
gelb.setBackColor(getC(posgb));
|
|
|
|
gelb.setBackColor(getC(posgb));
|
|
|
|
remove.setBackColor((x > 0) ? Color.black : Color.gray);
|
|
|
|
remove.setBackColor((x > 0) ? Color.black : Color.gray);
|
|
|
|
|
|
|
|
weiter.setBackColor((x > 2) ? Color.black : Color.gray);
|
|
|
|
pl1.setText("");
|
|
|
|
pl1.setText("");
|
|
|
|
pl2.setText("");
|
|
|
|
pl2.setText("");
|
|
|
|
pl3.setText("");
|
|
|
|
pl3.setText("");
|
|
|
|
pl4.setText("");
|
|
|
|
pl4.setText("");
|
|
|
|
pl5.setText("");
|
|
|
|
pl5.setText("");
|
|
|
|
pl6.setText("");
|
|
|
|
|
|
|
|
switch(x) {
|
|
|
|
switch(x) {
|
|
|
|
case 6:
|
|
|
|
|
|
|
|
pl6.setText(pn[5]);
|
|
|
|
|
|
|
|
case 5:
|
|
|
|
case 5:
|
|
|
|
pl5.setText(pn[4]);
|
|
|
|
pl5.setText(pn[4]);
|
|
|
|
case 4:
|
|
|
|
case 4:
|
|
|
|