public class Textdemo {
private static class Color {
public Color() {
}
}
import java.awt.*; // Color, Font
public class TextDemo {
private PaintWindow window = new PaintWindow();
private Color brown = new Color(123,62,41);
private Color husfasad = new Color(128,64,0);
private Object Color;
private void hus(Color fasad, int x, int y) {
window.fillRect(x, y, 40, 20, fasad);
window.fillRect(x, y-10, 40, 10, Color.BLACK);
window.fillRect(x+35, y-14, 3, 4, Color.BLACK);
window.fillRect(x+8, y+4, 6, 8, Color.WHITE);
window.fillRect(x+26, y+4, 6, 8, Color.WHITE);
}
public void bakgrund() {
window.fillRect(0, 0, window.getBackgroundWidth(), 200, Color.CYAN);
window.fillOval(250, 140, 100, 100, Color.ORANGE);
window.fillRect(0, 200, window.getBackgroundWidth(), window.getBackgroundHeight()-200, Color.BLUE);
window.fillOval(300, 210, 200, 30, Color.GREEN);
window.fillOval(350, 190, 130, 50, Color.GREEN);
hus(brown, 390, 175);
hus(brown, 325, 197);
hus(brown, 320, 200);
}
public void text() {
int signaturX, signaturY;
Text titel = new Text("Solnedgång", new Font("SansSerif",Font.ITALIC,24),Color.ORANGE);
Text signatur = new Text("Rolf Axelsson");
signatur.setBackground(new Color(128,128,255));
window.showImage(titel, 50, 50);
signaturX = window.getBackgroundWidth() - signatur.getIconWidth() - 3;
signaturY = window.getBackgroundHeight() - signatur.getIconHeight() - 3;
window.showImage(signatur, signaturX, signaturY);
}
public static void main(String[] args) {
TextDemo u1b = new TextDemo();
u1b.bakgrund();
u1b.text();
}
}
}