wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Problem with JSplitPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with JSplitPane" Watch "Problem with JSplitPane" New topic
Author

Problem with JSplitPane

sanjay kams
Greenhorn

Joined: Jun 21, 2012
Posts: 12
Hi,
I have a problem with JSplitPane in my Gui. The problem is, I added a tabbedPane on the right Pane and added a table on the left Pane. The split pane displays in the whole window of my Gui. I want to give some heading above the split pane. I tried splitpane.setBounds() method. But the view of Gui is not changed, i.e., I need some space above the splitpane to give heading.
I have attached the related pieces of code:

splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, jtbGeneral, DetailsJPanel);
splitPane.setOpaque(false);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(200);
Dimension minimumSize = new Dimension(240, 860);
jtbGeneral.setMinimumSize(minimumSize);
DetailsJPanel.setMinimumSize(minimumSize);
splitPane.setPreferredSize(new Dimension(600, 860));

splitPane.setBounds(300, 300, 800, 1000);

Please give me some suggestions related to this .


Thanks in Advance

m Korbel
Ranch Hand

Joined: Jun 19, 2012
Posts: 154
see API for JSplitPane#setDividerLocation there is double value in range >=0 - <=1
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

sanjay kams, you didn't reply to the responses on your two earlier threads. When people offer free advice on a forum, it's nice to know whether the advice was helpful and whether your problem was solved.

Also, seeing as how you are evidently not aware of how to UseCodeTags, you might benefit from going through this page: How To Ask Questions On Java Ranch.

As to your question, you need to learn how to use layout managers effectively.

@m Korbel: I don't think that's related to the question asked here. It's just incidental (and irrelevant) that one of the components in the layout is a JSplitPane.


luck, db
There are no new questions, but there may be new answers.
sanjay kams
Greenhorn

Joined: Jun 21, 2012
Posts: 12

sorry. The problem is not solved. Still the Gui displays as like before.

Actually what I did is, I designed a Gui form like, created a Panel - added another one panel on it. Then added two Labels on the top of Panel, below the labels, added a Tabbed Pane(jtbGeneral) on the left side of Panel and added a table(DetailsJPanel) on the right side of Panel. I Designed the form like this.

Then I added a Split Pane like this.

JSplitPane splitPane;
splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, jtbGeneral, DetailsJPanel);
splitPane.setOpaque(false);
splitPane.setOneTouchExpandable(true);
splitPane.setDividerLocation(200);
Dimension minimumSize = new Dimension(240, 860);
jtbGeneral.setMinimumSize(minimumSize);
DetailsJPanel.setMinimumSize(minimumSize);
splitPane.setPreferredSize(new Dimension(600, 860));

splitPane.setBounds(300, 300, 800, 1000);

Please help me to get out from this problem.

Thanks

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

You still haven't gone through the links I suggested.
sanjay kams
Greenhorn

Joined: Jun 21, 2012
Posts: 12
Yes. I gone through it and got what I expected. Thanks a lot.

But while maximizing the Gui, the frame doesn't expands. Still its in minimized size only. I tried the component's setMaximumSize() also. But it not works. Any other way to do this? Please suggest me.
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

You shouldn't need to set any of preferred/max/min sizes. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates your layout problem. Note that not many members here are willing to attempt to analyze scarcely readable designer-generated code, so I suggest you code up your GUI manually.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> splitPane.setBounds(300, 300, 800, 1000);

based on the above line, you're either
a) using a null layout, in which case you deserve the problem you have
b) have very little idea how layoutManagers work

either way, the layoutManager link (already supplied to you) has the answer.
 
 
subject: Problem with JSplitPane
 
Similar Threads
JInternalframe will not maximise on setMaximum(true)
Can anyone solve this error and give a suggestion foe the following :
Accessing image files of user entered paths
SplitPane causes headache when resizing...
Drawing with mouse