[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/22949] swing: JTextField invisible with BoxLayout
From: |
gcc-bugzilla at gcc dot gnu dot org |
Subject: |
[Bug classpath/22949] swing: JTextField invisible with BoxLayout |
Date: |
16 Oct 2005 01:27:45 -0000 |
Steps to reproduce:
1. Compile and run the attached testcase
Expected results:
1. A window with two labels and a textfield between the labels shows up.
Actual results:
1. A window with two labels shows up but the textfield is not visible.
Testcase:
import javax.swing.*;
import java.awt.*;
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"));
this.setContentPane(panel);
this.pack();
}
}
If I comment out the line that does setLayout the textfield is visible.
------- Comment #1 from from-classpath at savannah dot gnu dot org 2005-05-22
14:20 -------
Thank you for reporting. I'll take care of this. I'm quite sure it has
something to do with the calculation of the text fields size. When the
textfield is for example instantiated with new JTextField("Hello world") then
it correctly shows up.
------- Comment #2 from from-classpath at savannah dot gnu dot org 2005-05-22
16:00 -------
I checked in a fix for that. The problem was that getMaximumSize() was not
implemented in javax.swing.plaf.basic.BasicTextUI and therefore some useless
default was returned, effectivly constraining the textfield's size to 0.
Could you please check if that works for you too?
------- Comment #3 from from-classpath at savannah dot gnu dot org 2005-05-22
18:06 -------
Yes, it works now with current classpath cvs HEAD. Thanks a lot!
------- Comment #4 from from-classpath at savannah dot gnu dot org 2005-05-22
18:09 -------
Ok, in this case I close this bug. Thanks alot for reporting!
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22949
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/22949] swing: JTextField invisible with BoxLayout,
gcc-bugzilla at gcc dot gnu dot org <=