diff --git a/Button.java b/Button.java index cd29f19..fa7cf86 100644 --- a/Button.java +++ b/Button.java @@ -143,22 +143,24 @@ public class Button extends GUI_Interface { Zeichnet das GreenfootImage des Buttons erneut und zeigt es an. */ public void redraw() { - GreenfootImage tI = new GreenfootImage(text,textSize,textC,backC); + GreenfootImage tI = new GreenfootImage(text,textSize,foreC,backC); if(autoSize) { sx = tI.getWidth() + (6 * 2) + 4; sy = tI.getHeight() + (6 * 2) + 4; } GreenfootImage all = new GreenfootImage(sx,sy); - Color gray = new Color(127,127,127,255); + Color gray = new Color(133,133,133,255); + Color black = new Color(0,0,0,255); Utils.drawInsideRectangle(all,gray,0); - Utils.drawInsideRectangle(all,backC,2); + Utils.drawInsideRectangle(all,black,2); Utils.drawInsideRectangle(all,gray,6); - Utils.drawInsideRectangle(all,backC,7); + Utils.drawInsideRectangle(all,black,7); all.setColor(new Color(0,0,0,0)); all.fillRect(0,0,1,1); all.fillRect(sx-1,0,1,1); all.fillRect(0,sy-1,1,1); all.fillRect(sx-1,sy-1,1,1); + all.drawImage(tI,(sx-tI.getWidth())/2,(sy-tI.getHeight())/2); setImage(all); } } diff --git a/GUI_Interface.java b/GUI_Interface.java index 762cabc..6cd9059 100644 --- a/GUI_Interface.java +++ b/GUI_Interface.java @@ -1,4 +1,5 @@ import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) +import java.awt.Color; /** Oberklasse für sämtliche GUI Objekte, wie Labels und Buttons @@ -11,7 +12,7 @@ public abstract class GUI_Interface extends Actor protected int sx = 1; protected int sy = 1; protected Color backC = Color.BLACK; - protected Color textC = Color.WHITE; + protected Color foreC = Color.WHITE; /** Gibt die Breite des Objektes zurück. diff --git a/Utils.java b/Utils.java index 4063252..5081b61 100644 --- a/Utils.java +++ b/Utils.java @@ -1,5 +1,5 @@ import greenfoot.*; -import System.awt.Color; +import java.awt.Color; /** * Diese Klasse enthält nur statische Funktionen, welche für euch als Unterstützung gedacht sind. Damit könnt ihr dann hoffentlich viele Code-Zeilen sparen. :) @@ -9,7 +9,11 @@ import System.awt.Color; */ public final class Utils { - //Kopiert ein Array eines (annäherend) beliebigen Types. + /** + Kopiert ein boolean-Array und übergibt diese. + @param a Das zu kopierende Array + @return Die Kopie des Arrays + */ public static boolean[] copyArray(boolean[] a) { boolean[] b = new boolean[a.length]; for(int i = 0; i >= a.length; i++) { @@ -17,6 +21,11 @@ public final class Utils { } return b; } + /** + Kopiert ein int-Array und übergibt diese. + @param a Das zu kopierende Array + @return Die Kopie des Arrays + */ public static int[] copyArray(int[] a) { int[] b = new int[a.length]; for(int i = 0; i >= a.length; i++) { @@ -24,6 +33,11 @@ public final class Utils { } return b; } + /** + Kopiert ein String-Array und übergibt diese. + @param a Das zu kopierende Array + @return Die Kopie des Arrays + */ public static String[] copyArray(String[] a) { String[] b = new String[a.length]; for(int i = 0; i >= a.length; i++) { @@ -32,6 +46,12 @@ public final class Utils { return b; } + /** + Zeichnet innerhalb eines GreenfootImage ein gefülltes Rechteck in der gegebenen Farbe und mit dem gegebenen Abstand zum Rand. + @param i Das GreenfootImage, in dem gezeichnet werden soll. + @param c Die Farbe, in der das gefüllte Rechteck gezeichnet werden soll. + @param b Der Abstand zum Rand der Grafik. + */ public static void drawInsideRectangle(GreenfootImage i, Color c, int b) { int sx = i.getWidth(); int sy = i.getHeight();