MnMWizard icon

db day 12

MnMWizard | PRO | 04/09/18 05:09:07 PM UTC | 0 ⭐ | 715 👁️ | Never ⏰ | []
Java |

1.26 KB

|

None

|

0 👍

/

0 👎

//Mason Marnell
// GraphicsRunner class (I assume you don't need my DatabaseProject class because all I did was add new GraphicsRunner(); to the main
 
 
import javax.swing.JFrame;
import java.awt.*;
import java.io.File;
import javax.imageio.ImageIO;
 
 class MakeImage extends Canvas
{
   public MakeImage()    //constructor - sets up the class
   {
      setSize(800,600);
      setBackground(Color.YELLOW);
      setVisible(true);
   }
 
   public void paint( Graphics window )
   {
     
      window.setColor(Color.WHITE);
      window.fillOval( 210, 100, 400, 400 );
      window.setColor(Color.BLACK);
      window.drawOval(210, 170, 300, 300);
      window.setColor(Color.BLACK);
      window.drawOval(210, 180, 250, 250);
      window.setColor(Color.BLACK);
      window.drawOval(210, 210, 175, 175);
      window.setColor(Color.BLACK);
      window.fillOval( 210, 250, 100, 100);
   
   }
 
  
  
}
 
 
public class GraphicsRunner extends JFrame
{
    private static final int WIDTH = 800;
    private static final int HEIGHT = 600;
 
    public GraphicsRunner()
    {
        super("Graphics Runner");
 
        setSize(WIDTH,HEIGHT);
 
        getContentPane().add(new MakeImage());
 
        setVisible(true);
 
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
 
    
}

Comments