0

I have a Swing JFrame with some controls in a GridLayout.

My problem is that the controls (Text fields) appear too small when the frame is minimized. I tried to avoid this by setting:

setPreferredSize

and

setSize

but still, I have to maximize the frame to see the controls clearly.

How can I solve this ?

Thanks enter image description here

Mina Wissa
  • 10,923
  • 13
  • 90
  • 158
  • 1
    Please edit your question to include an [sscce](http://sscce.org/) that exhibits the problem you describe. See also [Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing](http://stackoverflow.com/q/7229226/230513)? – trashgod Oct 19 '12 at 17:35

1 Answers1

1

No code is posted, but it is possible that you're not constructing the textfields with specified number of columns. setPreferredSize or setSize are not needed, try this instead:

JTextField tf = new JTextField(30)

which will create a textfield of fixed size (columns) 30. This way your textfields will not shrink or expand.

Rempelos
  • 1,220
  • 10
  • 18