Reputation: 3181
My friend is facing an issue where in he has a Swing Dialog and it has several text fields, combo boxes and radio buttons. Also it has a JPanel
which holds the search results if at all the user wants to perform any search.
It looks fine with normal font size. But once the font size is increased to say 150% or even 200%, then the text boxes are not growing and the text in them is growing. So, they are not fitting in and are getting clip-ed.
He managed to overcome this limitation by using the setPreferredSize
method on the UI components. Now it seems that he is able to control the behaviour in case of text boxes, combo boxes etc. But the search panel is still an issue.
Could some one please point out what the issue could be?
UPDATE: They also have a JTable where the search results are displayed. Now, the thing is, they are hardcoding the height of each row in that JTable using the call setRowHeight. And due to this, if the font size is increased, the row height still remains the same. Is there any method call that resolves this. We honestly think that they should not have done that hardcoding. Is there any solution for this? Please share.
Thanks, Pavan.
Upvotes: 1
Views: 87
Reputation: 4002
Try pack()
it will automatically adjust the Window
to fit the preferred size of the components.
Upvotes: 1
Reputation: 191
Which layout is your friend using? Choosing a suitable layout may help.
Upvotes: 1