Usually it stays unchanged automatically, with no special effort required. But some layout managers will change the height in some situations. The main example I know is BorderLayout - if you put a component in WEST or EAST its height will change, but its width will not; if you put the component in NORTH or SOUTH its width will change, but not height. If you put the component in CENTER (which is the default of you don't specify a constraint
string) then both width and height will change. So probably the solution is to use a different layout manager for the field, or to put the JComboBox in NORTH or SOUTH. You might consider using Box.createHorizontalBox(), or a GridBagLayout with constraints weightX = 1, weightY = 0, fill = HORIZONTAL. (No vertical stretching.)