Screenshot:

The textfield always worked fine, but suddenly was too small. You can still enter text, and when clicking the Print textJOptionPane.
I also tried both
JTextField tfld = new JTextField(10);
and
JTextField tfld = new JTextField("test adlfjsdlfjasdf");
but neither one helped.
Sounds like you are using a GridBagLayout. This happens on components that don't have a reasonable minimum size.
try you use
txtfield.setPreferredSize(new Dimension(int,int));
it will take parameters for Dimension you can read this for further assistance
http://docs.oracle.com/javase/6/docs/api/javax/swing/JComponent.html#setPreferredSize%28java.awt.Dimension%29
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With