Advertisement
MnMWizard

db day 12

Apr 9th, 2018
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.26 KB | None | 0 0
  1. //Mason Marnell
  2. // GraphicsRunner class (I assume you don't need my DatabaseProject class because all I did was add new GraphicsRunner(); to the main
  3.  
  4.  
  5. import javax.swing.JFrame;
  6. import java.awt.*;
  7. import java.io.File;
  8. import javax.imageio.ImageIO;
  9.  
  10.  class MakeImage extends Canvas
  11. {
  12.    public MakeImage()    //constructor - sets up the class
  13.    {
  14.       setSize(800,600);
  15.       setBackground(Color.YELLOW);
  16.       setVisible(true);
  17.    }
  18.  
  19.    public void paint( Graphics window )
  20.    {
  21.      
  22.       window.setColor(Color.WHITE);
  23.       window.fillOval( 210, 100, 400, 400 );
  24.       window.setColor(Color.BLACK);
  25.       window.drawOval(210, 170, 300, 300);
  26.       window.setColor(Color.BLACK);
  27.       window.drawOval(210, 180, 250, 250);
  28.       window.setColor(Color.BLACK);
  29.       window.drawOval(210, 210, 175, 175);
  30.       window.setColor(Color.BLACK);
  31.       window.fillOval( 210, 250, 100, 100);
  32.    
  33.    }
  34.  
  35.  
  36.  
  37. }
  38.  
  39.  
  40. public class GraphicsRunner extends JFrame
  41. {
  42.     private static final int WIDTH = 800;
  43.     private static final int HEIGHT = 600;
  44.  
  45.     public GraphicsRunner()
  46.     {
  47.         super("Graphics Runner");
  48.  
  49.         setSize(WIDTH,HEIGHT);
  50.  
  51.         getContentPane().add(new MakeImage());
  52.  
  53.         setVisible(true);
  54.  
  55.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  56.     }
  57.  
  58.    
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement