Article View: borland.public.jbuilder.java.swing
Article #11699JSplitPane and initial Divider Locaation problem
From: Jeff Carlson
Date: Tue, 20 Apr 1999 00:00
Date: Tue, 20 Apr 1999 00:00
43 lines
2048 bytes
2048 bytes
Hello, I am having trouble with setting the initial size of a JSplitPane and was wondering if any of you had run into this and possibly solved it. Behavior: in the jbInit() I do the following: 1) Add everything to two panels (pnlTop and pnlBottom). 2) Create the SplitPane like so: splitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, pnlTop, pnlBottom); 3) Then I try to do this: splitter.setDividerLocation((double)0.70); splitter.setOneTouchExpandable(true); splitter.setDividerSize(6); 4) Then I try a repaint() before I show the application. When the application starts the splitter is at DividerLocation(0.0) - the very top. I can click on the splitter once and it jumps to the place it should have been (just below the middle of the window). The _only_ way I can get the (*&!@$# splitter to kind of show up in the correct place is to add a this_componentShown(ComponentEvent e) and do this in the body of the method: app.splitter.setDividerLocation(0.70); where app is a reference to the mainapp where the reference to splitter lives. This does kind of work, but the app is shown and then the bar jumps down to it's correct position - making things look very sloppy. So the questions: 1) Why does splitter.setDividerLocation((double)0.70); _not_ work while app.splitter.setDividerLocation((double)0.70); _does_ work in a stupid componentShown event? And 2) How can I get the splitter to behave and set it's position correctly before it's painted on screen? TIA, Jeff Carlson
Technical Details
Message-ID:
<7fi0ug$d7u1@mascagni.pfizer.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,dccce507cfc6ab83,start X-Google-Attributes: gid111d45,public From: "Jeff Carlson" <Jeffrey_F_Carlson@groton.pfizer.com> Subject: JSplitPane and initial Divider Locaation problem Date: 1999/04/20 Message-ID: <7fi0ug$d7u1@mascagni.pfizer.com> X-Deja-AN: 468719519 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Pfizer Inc. X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing