import javax.swing.JFrame;

public class Game extends JFrame {
  public Game(BigBang b) {
    this.add( b ); 
    this.setSize(400, 400); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    JFrame f = new Game( new BigBang() ); 
  }
}

import javax.swing.JComponent; 
import java.awt.Graphics;

public class BigBang extends JComponent {
  public void paintComponent(Graphics g) {
    g.drawOval(40, 40, 120, 160);
  }
}

--------------

https://docs.oracle.com/javase/8/docs/api/javax/swing/Timer.html

--------------

import javax.swing.JComponent; 
import java.awt.Graphics;
import javax.swing.Timer;
import java.awt.event.ActionListener; 
import java.awt.event.ActionEvent; 

public class BigBang extends JComponent implements ActionListener {
  Timer timer; 
  public BigBang() {
    this.timer = new Timer(1000, this);  
    this.timer.start(); 
  }
  int i; 
  public void actionPerformed(ActionEvent e) {
    this.i += 1; 
    System.out.println( i + " ticks have passed." );  
  }
  public void paintComponent(Graphics g) {
    g.drawOval(40, 40, 120, 160);
  }
}

import javax.swing.JFrame;

public class Game extends JFrame {
  public Game(BigBang b) {
    this.add( b ); 
    this.setSize(400, 400); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    JFrame f = new Game( new BigBang() ); 
  }
}

---------

Kirk Mitchell Mitch 

Jordan Joshua Nicolas Alex Menghan 

Yuanyuan Jerry Drake Chad Chetan Younghun Tianqi 

Elizabeth Tobias DeAsis Rui Magdalena Sarah 


-----------

import javax.swing.JComponent; 
import java.awt.Graphics;
import javax.swing.Timer;
import java.awt.event.ActionListener; 
import java.awt.event.ActionEvent; 

public class BigBang extends JComponent implements ActionListener {
  Timer timer; 
  World world; 
  public BigBang(int delay, World world) {
    this.world = world; 
    this.timer = new Timer(delay, this);  
    this.timer.start(); 
  }
  public void actionPerformed(ActionEvent e) {
    this.world.teh(); 
    this.repaint(); 
  }
  public void paintComponent(Graphics g) {
    this.world.draw(g); 
  }
}

import java.awt.Graphics; 
import java.awt.event.KeyEvent; 
import java.awt.event.MouseEvent; 

interface World {
  public void teh(); 
  public void draw(Graphics g); 
  public void keh(KeyEvent e);
  public void meh(MouseEvent e); 
}import java.awt.Graphics; 
import java.awt.event.KeyEvent; 
import java.awt.event.MouseEvent; 

interface World {
  public void teh(); 
  public void draw(Graphics g); 
  public void keh(KeyEvent e);
  public void meh(MouseEvent e); 
}


import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Game extends JFrame implements World {
  int ticks; 
  public void teh() {
    this.ticks += 1;
  }
  public void draw(Graphics g) { 
    g.drawString( "I am the world, " + this.ticks + " old.", 50, 50 ); 
  }
  public void keh(KeyEvent e) { }
  public void meh(MouseEvent e) { }
  public Game() {
    this.setSize(400, 400); 
    this.setVisible(true); 
  }
  public static void main(String[] args) {
    Game g = new Game(); 
    BigBang b = new BigBang(1000, g); 
    g.add( b );     
  }
}

--



Derek 

LeAnne 

Kyle 


import javax.swing.*;
import java.awt.event.*; 
import java.util.*; 
import java.awt.*;

public class Game implements World {
  Circle circle = new Circle(200, 200, 30, Color.WHITE); 
  public void update() {

  }
  public void draw(Graphics g) {
    this.circle.draw(g); 
  }
  public void mousePressed(MouseEvent e) { // meh

  } 
  public void keh(KeyEvent e) { 
    System.out.println( "Ha, ha, ha: " + e.getKeyChar() ); 
    if (e.getKeyChar() == 'a') {
      this.circle.left();  
    } else if (e.getKeyChar() == 'd') {
      this.circle.right();
    } 

  } // keh 
  
  public static void main(String[] args) {
    BigBang game = new BigBang(500, new Game()); // reminder: 30 is the delay between ticks 
    JFrame frame = new JFrame("Something"); 
    frame.getContentPane().add( game ); 
    game.addMouseListener( game ); 
    frame.addKeyListener( game ); // game.addkeyListener( game ); // read to see under what conditions this works 
    frame.setVisible(true); 
    frame.setSize(400, 400); 
    frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 
    game.start(); 
  }
  public boolean hasEnded() {
    return false; // never!! 
  }
}


// Circle.java 

import java.awt.*; 

class Circle {
  int x, y; // center
  int radius;
  Color color; 
  Circle(int x, int y, int radius, Color color) {
    this.x = x; 
    this.y = y;
    this.radius = radius;
    this.color = color;
  }
  void draw(Graphics g) {
    g.setColor(Color.YELLOW); 
    g.fillOval(this.x - this.radius,
               this.y - this.radius,
               this.radius * 2,
               this.radius * 2); 
    g.setColor(this.color); 
    g.drawOval(this.x - this.radius,
               this.y - this.radius,
               this.radius * 2,
               this.radius * 2); 
  }
  void enlarge() {
    this.radius += 1; 
  }
  void fall() {
    this.y += 5;  
  }
  void left() {
    this.x -= 5;  
  }
  void right() {
    this.x += 5;  
  }

}

--