I'm not sure if GridBagLayoutManager is the only layout manager that does this, but here is my problem. I have 4 controls arranged horizontally in a GridBagLayout. To make it easier in this example, each control gets equal to 1/4 of the shape, and each control changes with the same ratio as the other controls. The four controls are JTextField, where each text field is mapped to a column in a record from a ResultSet. Additional controls on the form allow you to navigate records.
If I move from one record to another, the text fields update the text to show new data. However, text fields also automatically change in proportion to the amount of text that they display ... text fields with a large amount of data expand in size, and text fields with less data are tricked. If I ran 10 records in a ResultSet, then the controls always resize and look pretty weird, to say the least.
I would like these controls not to change unless (and until) the underlying container is changed. Therefore, if I resized the window, I would like the controls to change (in accordance with the variable "weight x" in the layout), but I do not want the controls to change just because the amount of text that they show becomes more or less.
Does anyone have any idea?
source
share