How to increase the width of a Jcombobox?

Asked

Viewed 653 times

0

How do I increase the width of a JComboBox in Java? The layout I’m using is as follows::

setLayout(new FlowLayout(FlowLayout.LEFT));

2 answers

1

The FlowLayout uses the pre-rated component size:

int largura = 100;
int altura = 21;
seuComboBox.setPreferredSize( new Dimension(largura,altura) );

0

Try this.

comboBox.setMaximumSize( comboBox.getPreferredSize() );

Browser other questions tagged

You are not signed in. Login or sign up in order to post.