This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Real-World Software Development: A Project-Driven Guide to Fundamentals in Java and have Dr. Raoul-Gabriel Urma & Richard Warburton 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.