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 revisionPrevious revision
Next revision
Previous revision
balloons [2018/08/17 08:42] frchrisballoons [2018/08/18 20:14] (current) cthiel
Line 53: Line 53:
  
 <code java BalloonDrop.java> <code java BalloonDrop.java>
 +import java.awt.Color;
 import java.awt.Font; import java.awt.Font;
 import java.awt.Graphics; import java.awt.Graphics;
Line 60: 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 101: 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 121: 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 130: 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 143: Line 144:
  repaint();  repaint();
  }  }
- + 
  @Override  @Override
  /**  /**
balloons.txt · Last modified: 2018/08/18 20:14 by cthiel

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki