Before the code...just give a couple of pointers (hope it helps).
Although constructers obviously return something they sound not have anything between public and functionName. This is a special case that only applies to constructors.
If you define a property to have a "_" at the start...carry this naming through the rest of the file. This is unlike some languages but necessary in Java.
Best to put classes into packages to group them (similar to directories). It means that you can organise them and keep different bits of code together. (see first line of each file).
If you want to use a external class you need to import it (see the last import line in each list).
The rest looks great...Your going great guns. Here's one that compiles for you, just cut and past over your files:
ReboundMouseListener.java
<START CUT HERE>
package com.jasoo2.rebound;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.jasoo2.rebound.ReboundGUI2;
//*****************************************************************
// Represents the mouse listener for the gui.
//*****************************************************************
public class ReboundMouseListener implements MouseListener
{
private ReboundGUI2 _reb = new ReboundGUI2();
public ReboundMouseListener ( ReboundGUI2 _reb )
{
this._reb = _reb;
}
//--------------------------------------------------------------
// Stops or starts the timer (and therefore the animation)
// when the mouse button is clicked.
//--------------------------------------------------------------
public void mouseClicked (MouseEvent event)
{
if (_reb.isRunning()) //note that var timer is not local to
_reb.stopTimer(); //this object! Why is access legal?
else
_reb.startTimer();
}
//--------------------------------------------------------------
// Provide empty definitions for unused event methods.
//--------------------------------------------------------------
public void mouseEntered (MouseEvent event) {}
public void mouseExited (MouseEvent event) {}
public void mousePressed (MouseEvent event) {}
public void mouseReleased (MouseEvent event) {}
} //ReboundMouseListener (inner class)
<STOP CUT HERE>
ReboundGUI2
<START CUT HERE>
package com.jasoo2.rebound;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.jasoo2.rebound.ReboundMouseListener;
public class ReboundGUI2 extends JFrame
{
private final int GUI_WIDTH = 300;
private final int GUI_HEIGHT = 200;
private final int IMAGE_SIZE = 35;
private final int DELAY = 20;
private Timer timer;
private boolean timerRunning = false;
private ImageIcon image;
private int x, y, moveX, moveY;
private JPanel panel = new JPanel();
public static void main(String[] args) {
ReboundGUI2 r = new ReboundGUI2();
r.init();
r.setVisible(true);
} //main
//-----------------------------------------------------------------
// Sets up the gui, including the timer for the animation.
//-----------------------------------------------------------------
public void init()
{
super.setContentPane(panel);
super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
ReboundMouseListener a = new ReboundMouseListener(this);
super.addMouseListener (a);
timer = new Timer (DELAY, new ReboundActionListener());
timer.start();
timerRunning = true;
x = 0;
y = 40;
moveX = 3;
moveY = 3;
image = new ImageIcon("happyface.gif"

;
super.setBackground (Color.black);
super.setSize (GUI_WIDTH, GUI_HEIGHT);
}
public boolean isRunning()
{
return timerRunning;
}
public void startTimer()
{
timer.start();
timerRunning = true;
}
public void stopTimer()
{
timer.stop();
timerRunning = false;
}
//-----------------------------------------------------------------
// Draws the image in the current location.
//-----------------------------------------------------------------
public void paint (Graphics page)
{
page.clearRect(0, 0, GUI_WIDTH, GUI_HEIGHT);
page.drawImage (image.getImage(), x, y, this);
}
//*****************************************************************
// Represents the action listener for the timer.
//*****************************************************************
private class ReboundActionListener implements ActionListener
{
//--------------------------------------------------------------
// Updates the position of the image and possibly the direction
// of movement whenever the timer fires an action event.
//--------------------------------------------------------------
public void actionPerformed (ActionEvent event)
{
x += moveX;
y += moveY;
if (x <= 0 || x >= GUI_WIDTH-IMAGE_SIZE)
moveX = moveX * -1;
if (y <= 22 || y >= GUI_HEIGHT-IMAGE_SIZE)
moveY = moveY * -1;
repaint();
} //action Performed
} //ReboundActionListener (inner class)
} //ReboundGUI
<STOP CUT HERE>
Hope that helped.
Kev