Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Screen scrolling.

 
Bod McLeon
Ranch Hand
Posts: 65
Eclipse IDE IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been off coding for a while unfortunately, but that won't stop me!

Anyway, is there a way to do a screen scrolling kind of thing.

This code VV makes a blank JOptionframe that is 800 x 3000. (just test it out for the next part to make sense)

Once you have tested it out as your 'character' gets nearer the top i want it to start moving/scrolling upwards. If there is a way, what is the code, or is it just plain impossible?
 
Piet Souris
Rancher
Posts: 1641
36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to use a JOptionPane for that, and with such a size?

Two ways that come to my mind are
* put your pane or panel inside of a JScrollPane. See the tutorial https://docs.oracle.com/javase/tutorial/uiswing/components/scrollpane.html
* use a large enough BufferedImage as your area, and redraw the relevant part when necessary
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!