Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main extends JFrame{
- final int TITLE_BAR_HEIGHT = 20;
- int x, y, radius;
- int dx, dy;
- public Proje(){
- this.x = 20;
- this.y = 50;
- this.radius = 100;
- this.dx = 1;
- this.dy = 1;
- setSize(640, 640);
- setTitle("Shapes");
- setVisible(true);
- setDefaultCloseOperation(ShapeWindow.EXIT_ON_CLOSE);
- }
- public void paint(Graphics g) {
- super.paint(g);
- g.clearRect(0, 0, getWidth(), getHeight());
- g.setColor(Color.BLUE);
- g.drawOval((getWidth()-radius)/2 , (getHeight()-
- radius+TITLE_BAR_HEIGHT)/2, radius, radius);
- g.setColor(Color.MAGENTA);
- g.drawRect((getWidth()-150)/3, ((getHeight()-150+TITLE_BAR_HEIGHT)/3),
- radius, radius);
- g.setColor(Color.MAGENTA);
- g.drawRect(((getWidth()-80)/3)*2,
- (getHeight()-150+TITLE_BAR_HEIGHT)/3, radius, radius);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement