JDK-4155064 : JSplitPane should support more than 2 components
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.2.0
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 1998-07-07
  • Updated: 1999-03-01
  • Resolved: 1999-03-01
Related Reports
Relates :  
Description
The JSplitPane only supports 2 components (by specification).
In some cases it would be useful to have more than 2 components.
Microsofts MFC splitter supports 16x16 components.
It would be nice to have this capability in Swing as well.

Comments
EVALUATION ralph.kar@Eng 1998-07-07 This change was requested by SAP, but I would definetely consider it a low priority RFE right now since the API is frozen. This change would require public API changes and a major architectural overhaul. scott.violet 1999-03-01 I agree, a component that split multiple components would be very useful. JSplitPane was designed to split only two components though, splitting multiple components would, more than likely, require breaking backward compatability.
11-06-2004

WORK AROUND ralph.kar@Eng 1998-07-08 A possible workaround for the problem is to nest JSplitPanes into each other. See also 4131528 about this. Here is an example of how this can be done: import com.sun.java.swing.*; import java.awt.*; import java.awt.event.*; public class NestedSplitPanes extends JFrame { JButton[] arrB = new JButton[16]; JSplitPane[] arrS = new JSplitPane[15]; public NestedSplitPanes() { super("Nested JSplitPanes"); for (int i=0; i<16; i++) { arrB[i] = new JButton("Button " + (i + 1)); } for (int i=0; i<8; i++) { arrS[i] = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, arrB[i*2], arrB[i*2+1]); } for (int i=8; i<12; i++) { arrS[i] = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, arrS[(i-8)*2], arrS[(i-8)*2+1]); } arrS[12] = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, arrS[8], arrS[9]); arrS[13] = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, arrS[10], arrS[11]); arrS[14] = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, arrS[12], arrS[13]); for (int i=0; i<15; i++) { // The following works because the JButtons in the // JSplitPanes have their own Borders. // Borderless components would have to be given a // border before doing this, otherwise the whole thing // looks really ugly and would even be almost unusable // in the Windows L&F (e.g. try JPanels instead of // JButtons. // If you comment out the following line you can // observe the stacking border problem (4131528). arrS[i].setBorder(null); } this.getContentPane().add(arrS[14]); this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent ev) { System.exit(0); } }); this.pack(); this.setVisible(true); } static public void main(String args[]) { new NestedSplitPanes(); } }
11-06-2004

PUBLIC COMMENTS JSplitPane should support more than 2 components scott.violet 1999-03-01 I agree, a component that split multiple components would be very useful. JSplitPane was designed to split only two components though, splitting multiple components would, more than likely, require breaking backward compatability.
10-06-2004