Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with mouseDragged(MouseEvent e)  RSS feed

 
ajay chaturvedi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is what i have written in my code:
public void mouseDragged(MouseEvent objMe)
{
TextField txtObject=(TextField)objMe.getSource();
int iNewX = objMe.getX();
int iNewY = objMe.getY();
txtObject.setLocation(iNewX,iNewY);
}
this Code allows me to move the control on the panel which is placed over applet.
But i have two problems
1. The movement is not very clean the TextField has two images and movemnet traces are shown.
2. When i Leave the mouse (Drag-over Or mouse-realse) the control jumps to some other position.
This is not what i intend i want the control to move with the mouse when the move is Dragged and stay where the mouse is Realased.
Plase Help Urgently.
ajay
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!