<p>I have a <em>JComboBox</em> and would like to have a separator in the list of elements. How do I do this in Java?</p>

<p>A sample scenario where this would come in handy is when making a combobox for font-family-selection; similar to the font-family-selection-control in Word and Excel. In this case I would like to show the most-used-fonts at the top, then a separator and finally all font-families below the separator in alphabetical order.</p>

<p>Can anyone help me with how to do this or is this not possible in Java?</p>

You can use a custom
```
ListCellRenderer
```
which would draw the separator items differently. See
docs
and a small
tutorial
.