balloons
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
balloons [2018/08/17 08:43] – frchris | balloons [2024/08/25 16:53] (current) – frchris | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | [[https:// | + | [[https:// |
CheckList: | CheckList: | ||
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, | public class BalloonFall extends JPanel implements KeyListener, | ||
{ | { | ||
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, | int size = Balloon.randomInt(50, | ||
int x = Balloon.randomInt(0, | int x = Balloon.randomInt(0, | ||
Line 144: | Line 144: | ||
repaint(); | repaint(); | ||
} | } | ||
- | + | ||
@Override | @Override | ||
/** | /** |
balloons.1534509813.txt.gz · Last modified: 2018/08/17 08:43 by frchris