File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes how to make zooming slowly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to make zooming slowly" Watch "how to make zooming slowly" New topic
Author

how to make zooming slowly

Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Hello everybody. Does anybody have any ideas how to make animated zoom. What I mean by this is how to make zooming slowly showing how it is zooming not at once. Any ideas? Thanks.(:
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.


luck, db
There are no new questions, but there may be new answers.
Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Darryl Burke wrote:From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.

Thanks for answering So, I should change zoom level inside the action performed method inside of action Listener of the timer or no? and a question what should I put inside that method if the answer is no. Cause I tried to play around with it and it did not do what I wanted it to(
Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Darryl Burke wrote:From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.

here is my code first one does not run at all and the second one increase but very quickly(

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

Why do you start the Timer inside a while(...) loop?
Bobby Marvikuan
Ranch Hand

Joined: Mar 14, 2012
Posts: 54
Darryl Burke wrote:Why do you start the Timer inside a while(...) loop?

It is stupid I know but I have read in the API that it stops before starting doing smth. So, I thought this is what I need because it will stop every time the I "increase my zoom" but it does not change anything if I put it outside
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
if you still have a problem, note that very few people will read 700 lines of code.

you'd be better off creating another program that just zooms a circle or square,
include your timer code (or perhaps a JSlider with listener), and if it still doesn't work
post that code (should be about 30 to 40 lines long), and when you find the solution
you can incorporate it into your 700 line program.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make zooming slowly