bug-classpath
[Top][All Lists]
Advanced

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

[Bug classpath/22951] swing: JTextField invisible with nested BoxLayouts


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22951] swing: JTextField invisible with nested BoxLayouts
Date: 16 Oct 2005 01:27:45 -0000

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

Expected results:
1. A window shows up. It has the following elements from right to left:
"label3", "label1", a textfield, "label2" and "label4".

Actual results (classpath 2005-05-22):
1. A window shows up but it has no visible elements.

Actual results (classpath 2005-05-21):
1. A window shows up. It has the expected labels in the right order but no
textfield is visible.

Testcase:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class jtextfield extends JFrame {
        public static void main(String[] args) {
                (new jtextfield()).show();
        }
        public jtextfield() {
                JPanel panel = new JPanel();
                panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
                panel.add(new JLabel("label1"));
                panel.add(new JTextField(4));
                panel.add(new JLabel("label2"));

                JPanel panel2 = new JPanel();
                panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); //
[1]
                panel2.add(new JLabel("label3"));
                panel2.add(panel);
                panel2.add(new JLabel("label4"));

                this.setContentPane(panel2);
                this.pack();
        }
}

Bug #13141 was fixed between 2005-05-21 and 2005-05-22. It is likely that the
fix caused the labels to become invisible in this testcase. Note that if I
comment out the line[1] that sets layout for the outer panel then all labels
and the textarea are rendered correctly.


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-05-22 
19:33 -------
Whoops, of course I mean "from left to right" and not "right to left"...


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-05-22 
20:39 -------
This bug is triggered through the fix for #13141, but not really related. The
problem is that an overflow occured in BoxLayout when the maximumSizes of the
labels and textfields are summed up, because the JTextField now have a
maximumSize of Integer.MAX_VALUE. I added a check for overflow in
javax.swing.BoxLayout, which should solve this bug. Could you please check
this?

/Roman


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-05-22 
21:19 -------
Yes, labels and the textfield are now rendered correctly.


------- Comment #4 from from-classpath at savannah dot gnu dot org  2005-05-25 
07:17 -------
So I close this bug. Thank you for reporting.


-- 


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





reply via email to

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