Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SplitPane question

Status
Not open for further replies.

kohinoor2007

Programmer
Mar 21, 2007
69
DE
Hi Guys,

I have a textarea component which is to be placed in the centre of 2 split panes.As I want this textarea component also to be resized using a splitpane divider,

I have put this "same textarea component" in two other spiltpanes to get the spiltpane divider(see code).

But the results doesnt't look.

It has actually produced 2 textareas(the black,& white background ones),although I have passed the same textarea.(See attached figure).


splitPaneLeftCentre = new SplitPaneLeftCentre(splitPaneLeft,ContentPane.this.textArea);
splitPaneRightCentre = new SplitPaneRightCentre(splitPaneRight,ContentPane.this.textArea);

Is it possible to put the same textarea in 2 different splitpanes.If so,what is the right way to do it...


Thanks..
 
You cannot place a single instance of a Swing component in multiple containers. Each component has only one 'state' to do with its location and size etc. Requiring it to be in several places at once makes no sense.

Tim
 
So Tim,I have another question.

I have put the leftspilt pane & the central text area in another splitpane(say the name as "leftPane").

The "leftPane" & the "rightpane", which is vertically split on the right side of the figure is put into another split pane which is split horizontally.

Now I have only 1 instance of the text area & everything looks fine.

Then if I move the vertical divider either on the left or right as in figure ,want only the textarea component & split area to resize.Thats not the case because it resizes the textarea as well as the other components in the corresponding split area.

Thanks
 
Moving the bar dividing a JSplitPane will resize the top level container on either side. If you don't want a particular sub-component within one of these to resize, well you could try setting that components MinimumSize, MaximumSize and PreferredSize all to the same value. That may fix its dimensions. I haven't tried this though.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top