User Tools

Site Tools


balloons

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
balloons [2018/08/17 08:43]
frchris
balloons [2018/08/18 20:14] (current)
cthiel
Line 61: Line 61:
 import java.awt.event.KeyListener; import java.awt.event.KeyListener;
 import java.util.ArrayList; import java.util.ArrayList;
 + 
 import javax.swing.JFrame; import javax.swing.JFrame;
 import javax.swing.JPanel; import javax.swing.JPanel;
 import javax.swing.Timer; import javax.swing.Timer;
 + 
 public class BalloonFall extends JPanel implements KeyListener, ActionListener public class BalloonFall extends JPanel implements KeyListener, ActionListener
 { {
Line 102: Line 102:
  window.addKeyListener(app);  window.addKeyListener(app);
  window.setVisible(true);  window.setVisible(true);
 + 
  }  }
 + 
  /**  /**
  *  This is the method to change what is drawn to the screen:  *  This is the method to change what is drawn to the screen:
Line 122: Line 122:
  x.draw(g);  x.draw(g);
  }  }
 + 
  }  }
 + 
 /** /**
  * These 3 methods need to be declared to implement the KeyListener Interface  * These 3 methods need to be declared to implement the KeyListener Interface
Line 131: Line 131:
  @Override  @Override
  public void keyTyped(KeyEvent e) {}  public void keyTyped(KeyEvent e) {}
 + 
  @Override  @Override
  public void keyPressed(KeyEvent e) {}  public void keyPressed(KeyEvent e) {}
 + 
  @Override  @Override
  public void keyReleased(KeyEvent e) {  public void keyReleased(KeyEvent e) {
 + 
  int size = Balloon.randomInt(50, 80);  int size = Balloon.randomInt(50, 80);
  int x = Balloon.randomInt(0, WIDTH);  int x = Balloon.randomInt(0, WIDTH);
Line 144: Line 144:
  repaint();  repaint();
  }  }
- + 
  @Override  @Override
  /**  /**
balloons.txt ยท Last modified: 2018/08/18 20:14 by cthiel