• Post Reply Bookmark Topic Watch Topic
  • New Topic

JComboBox

 
David Garratt
Ranch Hand
Posts: 213
Eclipse IDE Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a combo box on my form. The box is populated by using a vector that contains a object. The object contains a toString() method which combines a code and a description to form a result :-

a - description of a
b - description of b
etc.

I have created a function that pads out the code element of the string to a fixed length, but because the font is not of a fixed size the description element is not very well aligned. Should I experiment to find a fixed font or is there a better way to accomplish what I want ?

Dave
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set a ListCellRenderer, which gives you full control over how a combobox entry is rendered.

Moving to Swing/AWT...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!