Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Req: Help on design of zoomable image viewer.

Status
Not open for further replies.

imp

Programmer
Jul 24, 2000
9
US
I'm planning to develop an image viewer / paint application with zooming capability (i.e. where you can zoom in x2, x3, etc., making the image in the viewport display bigger & smaller, and being able to use scrollbars to move around the zoomed-in image). Are there standard Java objects available that would make this an easy task? If not, I'm open to suggestions on how to go about this. (I've been programming for a while, but am fairly new to Java.) Thanks.
 
image class
getScaledInstance(int, int) will set the new width and new height for an image. Its very slow for large images. And it doesn't like you to make the image too big.

Also I think that graphics has a method for scaling images but have not used it.

For the scrolling use JScrollPane.

Images come out nicely I find on JComponent. you will have to set the preffered size of your JComponent for the scroll bars to come up. And probably have to keep on changing this as you zoom in and out the image to change the lengths of the scrollbars.

Hope this helps to get you started.

PS if you find fast way of scaling even if the output isn't that good can you let me know.

Cheers

Chris


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top