import java.awt.Color;
import java.awt.Graphics;
public class RectangleAndOvalApplet extends Applet {
public void paint(Graphics g) {
// Draw a rectangle with orange color
g.setColor(Color.ORANGE);
g.drawRect(50, 50, 100, 80);
// Draw a right-aligned oval with orange color g.setColor(Color.ORANGE);
int ovalX = getWidth() - 150; // Right-aligned
int ovalY = 50;
int ovalWidth = 100;
int ovalHeight = 80;
g.fillOval(ovalX, ovalY, ovalWidth, ovalHeight); }
}
No comments:
Post a Comment