PDA

View Full Version : Animate SplitBar in BorderLayout



Alinanila
24 Nov 2010, 9:28 AM
Sorry if someone asked this before, but I could not find a matching solution...

I'm using a borderlayout: when the user clicks a toggle button, the splitbar between center and east region should move. For example on "expand" the east region should grow from 200px to 600px, on "collapse" it should do the opposite. Well, it's simple to set east.getSplitBar().setCurrentSize() to make the bar "jump" to its new position, but I want the bar (and the containers) to SLIDE! Using effects on center and east region caused the regions to slide/scale, but the bar remains unchanged until you call doLayout... :(

I also tried a collapsible panel, in this case the movement works, but I do not want to collapse the east region, just to shrink it (eg. to 200px).

Thanks in advance for any ideas,
Alina

Condor
25 Nov 2010, 8:09 AM
So you want both the east panel to shrink and the center region to grow at the same time?

You could do a chained animation of the panels main 'el's, but you still have to update the region width and call doLayout when the animation finishes to notify the layout of the change.