Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSplitPanes with JLists  RSS feed

 
Sam Ronald
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have in a program with two JSplitPanes which contain three JLists in it. I use JSplitPanes to put those three JLists under each other in the westPanel.
The problem is that the first JList is reduced to a minimum size and it is so small that you have to make it bigger by hand if you want to read the content.
Does any of you have got an idea how to avoid this "effect"?
//Splitter in WestPanel
JSplitPane westSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
JSplitPane westSecondSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
westSplitPane.setTopComponent(projectPanel);
westSecondSplitPane.setTopComponent(userPanel);
westSecondSplitPane.setBottomComponent(userinRoomPanel);
westSplitPane.setBottomComponent(westSecondSplitPane);
westPanel.add(westSplitPane);
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Szabolcs,
This is just a suggestion (and I haven't tried it myself), but have you tried either
  • using a different layout manager (than BorderLayout)
  • setting the "preferredSize" attribute of your "JList"s
  • a combination of both


  • Perhaps you should look at the tutorial entitled Effective Layout Management (if you haven't already done so).
    Good Luck,
    Avi.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!