Java Graphics (AWT) – Lamp Design Example Program
import java.awt.*;
public class Lamp extends java.applet.Applet {
public void paint(Graphics g) {
g.fillRect(0,250,290,290); // Lamp platform
g.drawLine(125,250,125,160); // Lamp stand
g.drawLine(175,250,175,160);
g.drawArc(85,157,130,50,-65,312); // Bottom of shade
g.drawArc(85,87,130,50,62,58); // Top of shade
g.drawLine(85,177,119,89); // Left side
g.drawLine(215,177,181,89); // Right side
g.fillArc(78,120,40,40,63,-174); // Dots
g.fillOval(120,96,40,40);
g.fillArc(173,100,40,40,110,180);
}
}
Comments
Post a Comment