scroll bar problems in java Layered Panes

Posted by vondip on Stack Overflow See other posts from Stack Overflow or by vondip
Published on 2009-09-08T08:18:03Z Indexed on 2010/06/16 5:02 UTC
Read the original article Hit count: 229

Filed under:
|
|

Hi all,

I've been trying to build this small java app. I find it very difficult to design UI in java, tasks that seem very simple become complicated and all these strange misbehaviors occur. In my app I've created a JLayeredPane which contains two layers. One on top on the other, They both contain scrollbars. Here's an explanation of the two layers:

Layer 1: A very big image inside something similar to a scrollpane. The image is scrollable.

Layer 2: A graphics2d object, this object draws an image. Once the image reaches a certain length, the layer gets a scrollpane that advances with the drawing with time.

I'd like to connect both layers. I want layer two to update the scrollbar on layer 1. Meaning that once it reaches a certain length, both scrollbars will advance together. When I try doing that, the two scroll bars really do advance, but ( ! ) this strange flickering occurs. I don't understand what is the reason for the flickering. Is there any other way to implement this in a simple manner? I must have the second layer on top of the first one (drawing on top of image)

since I cannot open a special post for thanking the wonderful people of this forum, I'll do it here. Thank you, you are great help. I hope this problem is solvable as well.

© Stack Overflow or respective owner

Related posts about java

Related posts about ui