Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make zooming slowly

 
Bobby Marvikuan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5126
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bobby Marvikuan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you start the Timer inside a while(...) loop?
 
Bobby Marvikuan
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic