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.
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.
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?
Yes, it works now with current classpath cvs HEAD. Thanks a lot!
Ok, in this case I close this bug. Thanks alot for reporting!