This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I presume you are familiar with the Listeners for Mouse and Mouse Motion? You should be able to use them. You should also be able to get information from the Image about its size and position and thence work out whether the click location is within the bounds of the Image.
Joined: Mar 18, 2007
I am in a Dilemma,
as I mentioned I want to capture clicks on the image, so that I can start rotating it. Initially I implemented it like this
this way I can always call getBounds() on the JLable and get its coordinates and then compare it with those which I get with the mousePressed MouseEvent. But the problem with this implementation is that later when I want to rotate the image, the method drawImage() takes in a parameter of type image and my JLable trick fails.
graphics2d.drawImage(image, x, y, this)
If I create the image as of type Image the rotation goes well, but I can�t get the coordinates of the image (though I am able to get the height and width).
Please help me out,
1. How do I get the coordinates of an Image 2. If I use JLable and ImageIcon for storing images, how do I rotate them.
Please help me out Thanks a lot
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com