This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes image zoom Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "image zoom" Watch "image zoom" New topic

image zoom

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I want to zoom in an image. I want user to click a point in the image, then I need to enlarge the image based on the point user click. That point should be the center in the new enlarged image.

How could I do that ?

Lou Pelagalli
Ranch Hand

Joined: Nov 11, 2003
Posts: 150
The ButtonSizing class posted by Craig Wood may help get you started, particularly method private Image getScaledImage(BufferedImage image, double scale).

Add on a MouseListener to get the MouseEvent and you should be able to size your image from the x/y of the click from the MouseEvent.

Hope it works for you.

I agree. Here's the link:
subject: image zoom
jQuery in Action, 3rd edition