|
Quick Lists
|
|
Bug ID:
|
4155064
|
|
Votes
|
1
|
|
Synopsis
|
JSplitPane should support more than 2 components
|
|
Category
|
java:classes_swing
|
|
Reported Against
|
swing1.0.2
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Will Not Fix,
request for enhancement
|
|
Priority:
|
5-Very Low
|
|
Related Bugs
|
4131528
|
|
Submit Date
|
07-JUL-1998
|
|
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.
|
|
Work Around
|
xxxxx@xxxxx 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();
}
}
|
|
Evaluation
|
xxxxx@xxxxx 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.
|
|
Comments
|
Submitted On 12-DEC-2000
aclong
I think this would be a very useful feature, too. Due to
the major changes that this would entail, I think it would
be better to have a new class rather than retrofitting
JSplitPane.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |