Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JSplitPane

 
sanjay kams
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
see API for JSplitPane#setDividerLocation there is double value in range >=0 - <=1
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sanjay kams
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You still haven't gone through the links I suggested.
 
sanjay kams
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic