Increasing size of combo box popup in Java

November 7, 2015 in Java, Programming, Programming Languages, Source Code, Tips & Tricks by admin

java-small-logoRecently I┬áhad a strange issue: how to increase the size of JComboBox popup without increasing the size of JComboBox itself, specifically displaying during selection options which are longer than the combo box itself. After various unsuccessful approaches, I’ve found a neat solution posted by Rob Camick in 2010 on Java Tips Webbog, in form of a class which acts as a PopupMenuListerner. This class itself allows even more functionalities than I hoped for, and also works neatly in java 8’s Swing. This is how a JComboBox with resized popup would look like:

For a longer description and the class’s usage and source code, follow the original article here.