I think this is a fairly well-known problem with JSplitPane. The only
solution I have found is to put the call to setDividerLocation inside a
component listener:
addComponentListener(new ComponentAdapter() {
public void componentResized(ComponentEvent evt) {
_splitPane.setDividerLocation(0.5);
}
});
This seems to work reliably, but if someone knows a better way, I'm open to
it.
tks,
pf
-----Original Message-----
From: Roger Blanken [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 19, 2001 3:15 PM
To: Advanced Swing
Subject: Split Pane Divider Location.
The following code in a constructor does not always work...
JSplitPane split = new...
Runnable run = new Runnable() {
public void run(){
split.setDividerLocation( .5 );
}
};
SwingUtilities.invokeLater( run );
I don't remember if I read somewhere that setDividerLocation should
be in the event thread or if I just tried it because it didn't
work the other way.
In any case, this only works sometimes. Other times I get
the 2nd component completely filling the pane (i.e. divider
location set to 0).
Seems to be some sort of race condition, but I can't glean
what is racing.
Any thoughts?
... Roger
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing