Article View: borland.public.jbuilder.java.swing
Article #1402animate move of JSplitPane divider?
From: Sam Seaborn
Date: Fri, 19 Dec 2003 18:56
Date: Fri, 19 Dec 2003 18:56
33 lines
1910 bytes
1910 bytes
Hi,
I have a routine that automatically moves the divider of a JSplitPane from,
say, 0 to 100 (to show/hide a panel in my frame). I simply use
splitPane.setDividerLocation(i) and it works great.
The thing is, I want to divider to slide back and forth with a smooth
"animated" effect.
I have tried something like the following:
// when button clicked
for (int iLocation=0; iLocation<100; iLocation++) {
final int i = iLocation;
SwingUtilities.invokeLater(new Runnable() {
public void run() {
splitPane.setDividerLocation(i);
revalidate();
try {
Thread.sleep(100);
} catch (Exception x) {}
}
});
}
But the result is, click the button, get a pause for a couple seconds, then
the divider goes the final location. I don't see any animation.
What am I doing wrong?
Any help is greatly appreciated,
SLL
Technical Details
Message-ID:
<3fe34916$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!news02.tsnz.net!newsfeed01.tsnz.net!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,c104217d747a468e,start X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-12-19 10:59:29 PST From: "Sam Seaborn" <sam@rightclick.ca> Newsgroups: borland.public.jbuilder.java.swing Subject: animate move of JSplitPane divider? Date: Fri, 19 Dec 2003 13:56:25 -0500 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 207.35.237.35 Message-ID: <3fe34916$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1071859990 207.35.237.35 (19 Dec 2003 10:53:10 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!priapus.visi.com!orange.octanews.net!news.octanews.net!news-out.visi.com!petbe.visi.com!in.100proofnews.com!in.100proofnews.com!news02.tsnz.net!newsfeed01.tsnz.net!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail