I don't think a JComboBox can be explicitly set to only display a certain number of characters. By default it is large enough to display the largest item contained within.
You may instead have to play around with the methods inherited from JComponent
This may be your only option, although it is a pain in the arse to use if you want portability because Java appears to have different display configurations in windows and linux platforms for example.
I usually get around this by creating a Dimension object that is calculated as a percentage of screen space rather than an absolute pixel value.
If anyone knows different, I would appreciate the knowledge as well.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.