bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22975] swing: layout manager oscillates with nested JSpli


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22975] swing: layout manager oscillates with nested JSplitPanes
Date: 16 Oct 2005 01:27:49 -0000

Steps to reproduce:
1. Compile and run the attached testcase.

Expected results:
1. A window shows up. It has three areas that are separated by two horizontal
lines. First two areas have the height of three lines while the third can only
show two lines of the textarea.

Actual results:
1. A window shows up. It has three areas but the horizontal lines that are
supposed to separate the areas oscillate constantly up and down.

Testcase:
import javax.swing.*;
import java.awt.*;
public class jsplitpane extends JFrame {
        public static void main(String[] args) {
                (new jsplitpane()).show();
        }
        public jsplitpane() {
                JSplitPane pane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
                JSplitPane pane2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
                pane1.setTopComponent(createTestPanel());
                pane1.setBottomComponent(pane2);
                pane2.setTopComponent(createTestPanel());
                pane2.setBottomComponent(createTestPanel());
                this.setContentPane(pane1);
                this.setSize(new Dimension(700, 200));
        }
        JPanel createTestPanel() {
                JPanel panel = new JPanel();
                JTextArea area = new JTextArea(5,5);
                area.setText("line1
line2
line3");
                panel.add(area);
                return panel;
        }
}


Note that the text is also bit misaligned but I'll submit another bug report
for that.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-06-08 
13:40 -------
Fixes are checked in. Could you retest?


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-06-08 
18:42 -------
Ok, the oscillation is now gone both in the reduced testcase and in a more
complex testcase. However, in the complex testcase one vertically split area
disappears completely after this fix.

The following more complex testcase is reduced from the user interface of the
omniscient debugger:

import javax.swing.*;
import java.awt.*;
public class jsplitpane extends JFrame {
        public static void main(String[] args) {
                (new jsplitpane()).show();
        }
        public jsplitpane() {
                JPanel topPanel = createTestPanel();
                topPanel.setLayout(new BorderLayout());
                getContentPane().add(topPanel);

                JSplitPane westPane1 = new
JSplitPane(JSplitPane.VERTICAL_SPLIT);
                JSplitPane westPane2 = new
JSplitPane(JSplitPane.VERTICAL_SPLIT);
                JSplitPane westPane3 = new
JSplitPane(JSplitPane.VERTICAL_SPLIT);
                JSplitPane centerPane1 = new
JSplitPane(JSplitPane.VERTICAL_SPLIT);
                JSplitPane centerPane2 = new
JSplitPane(JSplitPane.VERTICAL_SPLIT);
                centerPane1.setBottomComponent(centerPane2);
                JSplitPane splitPaneH = new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
                JSplitPane splitPaneH1 = new
JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
                topPanel.add(splitPaneH, BorderLayout.CENTER);
                splitPaneH1.setLeftComponent(westPane1);
                splitPaneH1.setRightComponent(centerPane1);
                splitPaneH.setLeftComponent(splitPaneH1);
                JPanel threadsPanel = createTestPanel();
                JPanel stackPanel = createTestPanel();
                JPanel localsPanel = createTestPanel();
                JPanel thisPanel = createTestPanel();

                westPane1.setTopComponent(threadsPanel);
                westPane1.setBottomComponent(westPane2);
                westPane2.setTopComponent(stackPanel);
                westPane2.setBottomComponent(westPane3);
                westPane3.setTopComponent(localsPanel);
                westPane3.setBottomComponent(thisPanel);

                JPanel codePanel = createTestPanel();
                centerPane2.setTopComponent(codePanel);
                JPanel tracePanel = createTestPanel();
                centerPane1.setTopComponent(tracePanel);
                JPanel TTYPanel = createTestPanel();
                centerPane2.setBottomComponent(TTYPanel);

                JPanel variablePanel = createTestPanel();
                splitPaneH.setRightComponent(variablePanel);
                this.setSize(new Dimension(400, 400));
        }
        JPanel createTestPanel() {
                JPanel panel = new JPanel();
                JTextArea area = new JTextArea(5,5);
                area.setText("line1\nline2\nline3\nline4\n");
                panel.add(area);
                return panel;
        }
}

If you try this testcase with 1) sun's jvm 2) classpath before fix and 3)
classpath after fix you will see that in case 2) the middle panel with three
horizontally split components is completely invisible although it is visible in
cases 1) and 3). And of course, case 3) also has the added oscillation :-)


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-06-10 
13:01 -------
Ok, I fixed that also. Please test again.


------- Comment #4 from from-classpath at savannah dot gnu dot org  2005-06-10 
14:27 -------
All the jsplitpane testcases I have here and the real application, omniscient
debugger, don't seem to suffer from oscillating layout now. Better yet, also
text is now correctly aligned and readable. Very nice, thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22975





reply via email to

[Prev in Thread] Current Thread [Next in Thread]