Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Draw a graphic and call it later?  RSS feed

 
john von
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, im trying to draw several pages(graphics) but i would like to view it one at a time. Ill put a next and back button to browse it. Is it possible? The graphics will require me to query on a database and i don't want to query everytime i access the other pages. So is there a way that i can hide the images drawn temporarily?
Thanks. Ive been working on this for quite sometime.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can draw into an "offscreen graphics buffer," basically an Image object. Basicaly you do something like



Then to actually put the image on screen, your paintComponent() call would just use Graphics.drawImage() to throw the Image up on the screen.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!