This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
how can i get the coordintes value of the mouse pointer within the frame . I need this to draw a rectangle , when the user clicks on one of the position and drags it a rectangle has to be drawn . The starting point of the rectangle should be pixel positions of the mouse pointer when the user clicks and ending point should be pixel co ordinates when the user releases the mouse button. Can anybody help me with this.
You need to add mouseListener and mouseMotionListener to the frame. The mouse event has getX() and getY() methods which will give you the co-ordinates you want. You might also want to read this tutorial.
Also, the MouseInputAdapter will be helpful to you so that you need to implement only the methods you really require.