Advertisement
RazorBlade57

Halloween Art Java Project

Oct 10th, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. //© A+ Computer Science  -  www.apluscompsci.com
  2. //Name - Christopher Clemente
  3. //Date - 12-10-2016
  4. //Class - AP Comp Sci
  5. //Lab  -
  6.  
  7. import java.awt.Font;
  8. import java.awt.Color;
  9. import java.awt.Graphics;
  10. import java.awt.Graphics2D;
  11. import java.awt.Canvas;
  12. import javax.swing.JPanel;
  13. import java.awt.event.ActionEvent;
  14. import java.awt.event.ActionListener;
  15.  
  16. public class ShapePanel extends JPanel
  17. {
  18.     public ShapePanel()
  19.     {
  20.         setBackground(Color.WHITE);
  21.         setVisible(true);
  22.     }
  23.  
  24.     public void update(Graphics window)
  25.     {
  26.         paint(window);
  27.     }
  28.  
  29.     /*
  30.      *All of your test code should be placed in paint.
  31.      */
  32.     public void paint(Graphics window)
  33.     {
  34.         // BackRound Color
  35.         window.setColor(Color.ORANGE);
  36.         window.fillRect(0,0,getWidth(), getHeight());
  37.         window.setColor(Color.RED);
  38.         window.drawRect(20,20,getWidth()-40,getHeight()-40);
  39.        
  40.         // (X,Y) (WIDTH HEIGHT)
  41.        
  42.         //Skeleton Head
  43.         window.setColor(Color.WHITE);
  44.         window.fillOval(230, 100, 250, 250);
  45.         window.fillOval(256, 195, 200, 200);
  46.         window.setColor(Color.BLACK);
  47.         window.fillOval(270, 175, 55, 55);
  48.         window.fillOval(375, 175, 55, 55);
  49.         window.fillOval(315, 270, 90, 90);
  50.         window.setColor(Color.WHITE);
  51.         window.fillOval(315, 240, 90, 90);
  52.         window.fillRect(347, 370, 20, 150);
  53.         window.fillRect(330, 580, 20, 150);
  54.         window.fillRect(347, 430, 20, 150);
  55.         window.fillRect(366, 580, 20, 150);
  56.         window.fillRect(270, 420, 180, 20);
  57.  
  58.  
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement