hi there, i want to make an application in which that if we select a shape to be drawn and the we draged the mouse in the panel aseries of the sames shape will be drawn
my prog in the other hand draw the shape and if i drage the shape the figure moves withe the mouse and if i want to draw another shape it disapers...im having truble with this mouse although it cute and a mazing; these are my mouse liseners interfaces :
public void mouseClicked( final MouseEvent event ) {
int x=event.getPoint().x;
int y=event.getPoint().y;
shapesList[selctIndex1].setFirstPoint(x, y);
repaint();
}
// handle event when mouse pressed
public void mousePressed( final MouseEvent event ) {
int x2=x1+20;
int y2=y1+30;
shapesList[selctIndex1].setSecondPoint(x2, y2);
x2=x2+5;
y2=y2+5;
repaint();
}
// handle event when mouse released after dragging
public void mouseReleased( final MouseEvent event ) {
}
// handle event when mouse enters area
public void mouseEntered( final MouseEvent event ) {
}
// handle event when mouse exits area
public void mouseExited( final MouseEvent event ) {
}
// MouseMotionListener event handlers // handle event when user drags mouse with button pressed
public void mouseDragged( final MouseEvent event ) {
x1=getX();
y1=getY();
drwanShapes.add(shapesList[selctIndex1]);
repaint();
}
// handle event when user moves mouse
public void mouseMoved( final MouseEvent event ) {
//do nothing
}
public void paint(Graphics g)
{
super.paint(g);
shapesList[selctIndex1].draw(g);
}
i reach the point were my mind is stuck and cannot think any one that can help
me i thank you in advance^___^