• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to make zooming slowly

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.(:
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:(
 
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You ought to ventilate your mind and let the cobwebs out of it. Use this cup to catch the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic