Advertisement
Guest User

Untitled

a guest
May 25th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. //Caroline Maloney
  2.  
  3. import javax.swing.*;
  4.  
  5. import java.awt.*;
  6.  
  7. public class Lab02 extends JPanel {
  8. public void paintComponent(Graphics g){
  9. g.setColor(Color.blue.darker()); //set background color
  10.  
  11. g.fillRect(0, 0, 400, 400);
  12.  
  13. g.setColor(new Color(150, 150, 0));
  14.  
  15. int r = 10;
  16.  
  17. for(int xg=107; xg<=260; xg+=2*r)
  18. {
  19. g.fillOval(xg-r, 40-r, 2*r, 2*r);
  20. }
  21.  
  22. for(int xh=100; xh<=250; xh+=2*r)
  23. {
  24. g.fillOval(xh, 220, 2*r, 2*r);
  25. }
  26.  
  27. for(int t=40; t<=220; t+=2*r)
  28. {
  29. g.fillOval(107-r, t-r, 2*r, 2*r);
  30. }
  31.  
  32. for(int u=40; u<=220; u+=2*r)
  33. {
  34. g.fillOval(260-r, u-r, 2*r, 2*r);
  35. }
  36.  
  37. g.fillRect(110, 40, 150, 190);
  38.  
  39. g.setFont(new Font("Serif",
  40. Font.BOLD, 20));
  41. g.drawString("Our Fearless Leader", 100, 280);
  42.  
  43.  
  44. ImageIcon thomas = new ImageIcon("tj.jpg");
  45. g.drawImage(thomas.getImage(), 120, 50, null);
  46.  
  47. }
  48.  
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement