Drawing Example Using the 2Dapi
public void paint(Graphics g) {
Graphics2D g2d = (Graphics2D)g;
g2d.setColor(Color.red);
Rectangle2D rect1 = new Rectangle2D.Double(32,42,100,100);
Rectangle2D rect2 = new Rectangle2D.Double(164,42,100,100);
g2d.fill(rect1);
g2d.draw(rect2);
}
}
Previous slide
Next slide
Back to first slide
View graphic version