I'm trying to make a circle appear from a class I've developed to move following the x co-ordinate of the mouse. I've done that part correctly, it's just loading the class...Can anyone tell me why it isn't loading?
I do love to solve problems myself but I've been working on this for a long time and I think it might be a silly mistake, I'm new to Java so I would really appreciate the help.
class MouseMovedListener implements MouseMotionListener
{
public void mouseMoved(MouseEvent e)
{
xposcounter = e.getX();
for(int i = 0; i <= grid.length; i++)
{
//Get the left hand side position of the grid
int leftxpos = pCenter.getWidth()/2 - ((GapConstant*(grid.length+6)+(grid.length*rw))/2) + rw*i + GapConstant*i;
//Get the right hand side position of the grid
int rightxpos = pCenter.getWidth()/2 + ((GapConstant*(grid.length+6)+(grid.length*rw))/2) +rw*i + GapConstant*i;
//Show the counter appearing above the columns the mouse is over
if(xposcounter > leftxpos && xposcounter < rightxpos)
{
//Load the circle
CircleComponent mycounter = new CircleComponent();
}
}
}
If you need to see the class code just ask...Thanks in advance for anyone who helps!