Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. package simpleapplet;
  2.  
  3. import java.applet.Applet;
  4. import java.awt.Color;
  5. import java.awt.Graphics;
  6.  
  7. /**
  8. *
  9. * @author 290826
  10. */
  11. public class SimpleApplet extends Applet {
  12.  
  13. @Override
  14. public void init() {
  15. resize(400, 400);
  16. }
  17.  
  18. public void paint(Graphics g) {
  19. g.setColor(Color.BLUE);
  20. g.drawOval(getWidth() / 2 - 20, getHeight() / 2 - 20, 40, 40);
  21. g.fillOval(getWidth() / 2 - 20, getHeight() / 2 - 20, 40, 40);
  22. g.drawOval(getWidth() / 2 - 40, getHeight() / 2 - 40, 80, 80);
  23. g.setColor(Color.red);
  24. g.drawLine(getWidth() / 2, getHeight() / 2 + 40, getWidth() / 2, getHeight() / 2 - 40);
  25. g.drawLine(getWidth() / 2 - 40, getHeight() / 2, getWidth() / 2 + 40, getHeight() / 2);
  26. }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement