I have a JComboBox
object in my JFrame
which behaves exactly as expected. However, I'd like to make it editable so that users can input alternative values if necessary. Unfortunately, using setEditable(true)
to enable editing causes its width to increase significantly. How can I allow editing of the JComboBox
while keeping its width only as wide as the largest selectable item requires?
The JComboBox
is in a JPanel
with a FlowLayout
, however I don't think this is relevant because changing the width of the JPanel
does not affect the width of the JComboBox
.