JScrollPane and zooming

Hi,I have created an image into JScrollPane. How to make the image zoom-out when I dragged the scroll bar rapidly, then when the mouse is released, the image will return to original size? Any idea to help me?
[236 byte] By [Ree86a] at [2007-11-26 22:07:58]
# 1

Why would you want to do that?

I never saw scroll bars used for zooming, it's really a strange request.

And anyway JScrollPane provides a scrollable view of a component and not scroll bars for free...

If you want to use a scroll bar for custom function use [url http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/JScrollBar.html]JScrollBar[/url], add a listener to it and handle the events:

http://www.java2s.com/Code/JavaAPI/javax.swing/JScrollBaraddAdjustmentListenerAdjustmentListenerl.htm

I would recommend using a JSlider for this instead:

http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html

Rodney_McKaya at 2007-7-10 10:53:46 > top of Java-index,Security,Cryptography...
# 2
Because I read about navigation technique called " Speed Dependant Automatic Zooming". I'm wondering whether this can work by using JScrollPane and zooming using Java2D. :) or may be anyone have idea to make this works?
Ree86a at 2007-7-10 10:53:46 > top of Java-index,Security,Cryptography...
# 3

As Rodney_McKay says, the scrolls from JScrollPane are not designed for zooming. If you are drawing an static Image, first put the internnal component to the desired size and draw the image applying the transfrmation to your graphics object.

i've just seen this applet about speed dependant zooimng:

http://www-ui.is.s.u-tokyo.ac.jp/~takeo/java/autozoom/autozoom.htm

I would use it, for example, for displaying a map from Google Earth.

I propose you this., let's develop a bean that recieve an large Image and apply this technique, and that the user can choose between standard mode and this.

Who wants to envolve?

RaulHuertasa at 2007-7-10 10:53:46 > top of Java-index,Security,Cryptography...