Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

image zoom

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?

Thanks
 
Lou Pelagalli
Ranch Hand
Posts: 150
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The ButtonSizing class posted by Craig Wood may help get you started, particularly method private Image getScaledImage(BufferedImage image, double scale).
http://www.coderanch.com/t/338181/GUI/java/JButton-ImageIcon-Size

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.

Lou
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic