Kapitel 12: "Bildverarbeitung"

"Bunt.java"


import java.awt.*;

public class Bunt extends FensterSchliesstSchickKurz{
public Bunt(String title1, int w, int h){
super(title1, w, h);
}

public void paint(Graphics g){
g.setColor(Color.RED);
g.fillRect(1,1,95,100);

g.setColor(new Color(255,0,0)); // Rot
g.fillRect(101,1,95,100);

g.setColor(new Color(0,255,0)); // Grün
g.fillRect(201,1,95,100);

g.setColor(new Color(0,0,255)); // Blau
g.fillRect(301,1,95,100);

g.setColor(new Color(255,255,0)); // Rot + Grün = ?
g.fillRect(401,1,95,100);

g.setColor(new Color(100,100,100)); // Rot + Grün + Blau = ?
g.fillRect(501,1,95,100);
}

public static void main(String[] args){
Bunt b = new Bunt ("Farbige Rechtecke", 500, 100);
}
}

Picksel Media Marco Block © 2006-2009 – ImpressumKontakt
Gestaltung und Umsetzung Tobias Losch, www.picksel-media.de