GUI Objekte verbessert

Button.redraw() vervollständigt
Fehlende Semikolonen hinzugefügt
4 Leerzeichen durch Tabs ersetzt (Verringerung der Dateigröße)
pull/20/head
Zocker1999NET 8 years ago
parent a1e62f825e
commit 4ac3af0cbf

@ -9,8 +9,8 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class Button extends GUI_Interface {
boolean autoSize = true;
Color foreC = Color.WHITE
Color backC = Color.BLACK
Color foreC = Color.WHITE;
Color backC = Color.BLACK;
int textSize = 1;
String text = "";
@ -18,7 +18,6 @@ public class Button extends GUI_Interface {
/**
* Erstellt einen Button mit dem gegebenen Objekt als Event-Handler.
*
* @param h Der Handler mit dem Interface ButtonEvent implementiert.
*/
public Button(ButtonEvent h) {
@ -78,16 +77,28 @@ public class Button extends GUI_Interface {
sy = tI.getHeight() + (csy * 2);
}
GreenfootImage all = new GreenfootImage(sx,sy);
all.drawImage(corner,0,0);
all.drawImage(corner,0,0); // top left
corner.rotate(90);
all.drawImage(corner,sx-csx,0);
all.drawImage(corner,0,sy-csy); // bottom left
corner.rotate(90);
all.drawImage(corner,sx-csx,sy-csy);
all.drawImage(corner,sx-csx,sy-csy); // bottom right
corner.rotate(90);
all.drawImage(corner,0,sy-csy);
for(int i = csx; i < (sx-csx+1); i++) {
all.drawImage(corner,sx-csx,0); // top right
for(int i = csx; i > (sx-csx); i++) {
all.drawImage(side,i,0); // top
}
side.rotate(90);
for(int i = csy; i > (sy-csy); i++) { // left
all.drawImage(side,0,i);
}
side.rotate(90);
for(int i = csx; i > (sx-csx); i++) { // bottom
all.drawImage(side,i,sy-csy);
}
for(int i = csy; i > (sy-csy); i++) {
all.drawImage(side,sx-csx,i); // right
}
side.rotate(90);
all.drawImage(tI,(sx-tI.getWidth())/2,(sy-tI.getHeight())/2);
setImage(all);
}

@ -25,6 +25,7 @@ public class GUI_Interface extends Actor
}
sx = w;
sy = h;
redraw();
}
public void act()

@ -9,8 +9,8 @@ import System.awt.Color;
*/
public class Label extends GUI_Interface {
Color foreC = Color.WHITE
Color backC = Color.BLACK
Color foreC = Color.WHITE;
Color backC = Color.BLACK;
int textSize = 1;
String text = "";

Loading…
Cancel
Save