Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BOUNCE CLASS:
- import javax.swing.*;
- public class Bounce extends JApplet {
- public Bounce(){
- add(new bouncepanel());
- }
- public static void main (String[] args); {
- JFrame win = new JFrame ("Bounce the ball");
- win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- win.setContentPane(new bouncepanel());
- win.pack();
- win.setVisible(true);
- }
- }
- BALLINBOX CLASS:
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.event.*;
- public class BallInBox extends JPanel {
- private Ball m_Ball = new Ball(0,0,2,3);
- //instance
- private int m_interval = 35; // Milliseconds between updates.
- private Timer m_timer; // Timer fires to animate one step.
- public BallInBox() {
- setPrefferedSize(new Dimension(200,80));
- setBorder(BorderFactory.createLineBorder(Color.BLACK);
- }
- public BallInBox() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement