Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //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);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement