Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / January 2004

Tip: Looking for answers? Try searching our database.

JSplitPane Not Acting Correctly

Thread view: 
Matthew Metnetsky - 06 Jan 2004 16:35 GMT
I've tried everything that I can find from the Java 1.4.2 API specs for
JSplitPane in order to control the splitter, but almost nothing works.  I
can manually drag it into the place I want, but no code I write affects
it, or actually works the way it says it should.

I have a splitpane as follows.

|======|======|
|      |      |
|======|======|

And I'd like it to look like this : which is as far as it stretches to the
right, but I cant get it to work in code.

|=========|===|
|         |   |
|=========|===|

Any ideas or suggestions are extremely welcome.  I've deleted all my code
except for the creation of JSplitPane because nothing I tried worked.

~ Matthew
Matthew Metnetsky - 06 Jan 2004 16:37 GMT
Hello,

> I've tried everything that I can find from the Java 1.4.2 API specs for
> JSplitPane in order to control the splitter, but almost nothing works.  I
[quoted text clipped - 18 lines]
>
> ~ Matthew

The boxes don't appear to have be displaying correctly above, but I'd
imagine its enough to get the general gist of my problem.

Thanks in advance,

~ Matthew
Steve W. Jackson - 06 Jan 2004 17:34 GMT
>:Hello,
>:
[quoted text clipped - 29 lines]
>:
>:~ Matthew

I presume you've tried setDividerLocation() or setDividerSize()?  But
those may not do much if you've got layout management that causes some
shifting to occur (I've had trouble with these in the past, too).  You
might try setting one of those values after you call pack().

= Steve =
Signature

Steve W. Jackson
Montgomery, Alabama

ak - 06 Jan 2004 23:10 GMT
> I've tried everything that I can find from the Java 1.4.2 API specs for
> JSplitPane in order to control the splitter, but almost nothing works.  I
> can manually drag it into the place I want, but no code I write affects
> it, or actually works the way it says it should.

ensure that both components are in JScrollPane and don't set preferredSize
explicitly.
always call setDividerLocation from EDT

if this don't work try following:

SwingUtilities.invokeLater(new Runnable() {
   public void run() {
       splitPane.setDividerLocation(location);
   }
};

it may be needed because, something changes divider location _after_ you set
it and you think that your code has no affect.

____________

http://reader.imagero.com the best java image reader.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.