Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1.  
  2. BOUNCE CLASS:
  3.  
  4. import javax.swing.*;
  5.  
  6. public class Bounce extends JApplet {
  7.  
  8. public Bounce(){
  9. add(new bouncepanel());
  10. }
  11. public static void main (String[] args); {
  12. JFrame win = new JFrame ("Bounce the ball");
  13. win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  14.  
  15. win.setContentPane(new bouncepanel());
  16.  
  17. win.pack();
  18. win.setVisible(true);
  19. }
  20.  
  21. }
  22.  
  23. BALLINBOX CLASS:
  24.  
  25.  
  26. import java.awt.*;
  27. import java.awt.event.*;
  28. import javax.swing.*;
  29. import javax.swing.event.*;
  30.  
  31. public class BallInBox extends JPanel {
  32.  
  33. private Ball m_Ball = new Ball(0,0,2,3);
  34.  
  35. //instance
  36. private int m_interval = 35; // Milliseconds between updates.
  37. private Timer m_timer; // Timer fires to animate one step.
  38.  
  39. public BallInBox() {
  40. setPrefferedSize(new Dimension(200,80));
  41. setBorder(BorderFactory.createLineBorder(Color.BLACK);
  42. }
  43.  
  44.  
  45.  
  46.  
  47. public BallInBox() {
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement