Skip to main content

ComboBox height in BorderLayout

4 replies [Last post]
thijs_swaenepoel
Offline
Joined: 2009-09-14
Points: 0

Hi all,

I'm using a Form in my app to display some Settings which the user can change.
Each setting is displayed in a BorderLayout container, with BorderLayout.WEST a TextArea component with the description of the setting and BorderLayout.EAST a ComboBox indicating the choices the user has to change the setting.

Now the description can consist of two lines or more (longer description) which causes the ComboBox to grow in height. I want to avoid that the ComboBox grows and to achieve that such a ComboBox has the same height as a ComboBox of which the corresponding TextArea only uses one line.

Any ideas?

Thanks in advance

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tfmahesh
Offline
Joined: 2009-11-16
Points: 0

try using cbx.setPreferredH([i]desired_height[/i]) where cbx is your ComboBox object.

--Mahesh

thijs_swaenepoel
Offline
Joined: 2009-09-14
Points: 0

Thanks for the replies.

I already tried setting the preferred height, but that doesn't chang anything. Using this method in combination with a TextArea of a single line does work, but for a TextArea with more than one line, the ComboBox automatically grows in height.

I'll try out the first suggestion and see what's the result there.

myinstinct
Offline
Joined: 2008-10-24
Points: 0

might try putting the ComboBox into another Container of BoxLayout.Y_AXIS flavor and put the new container in the EAST - that should allow the BoxLayout.Y_AXIS container to "stretch" and not your comboBox - just a thought.

thijs_swaenepoel
Offline
Joined: 2009-09-14
Points: 0

Thanks myinstinct, that did the trick.