Adding JSeparator to a DefaultListModel
I want to add some JSeparators to a JList. I am using a DefaultListModel, and when I try: ((DefaultListModel)myListModel).addElement(new JSeparator()); I'm getting this written into the JList instead of the separator when I execute: javax.swing.JSeparator[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.synth.SynthBorder@962d513,flags=0,maximumSize=,minimumSize=,preferredSize=,orientation=HORIZONTAL] little bit complicated in the renderer but possible, since example for JComboBox but with ListCellRenderer import java.util.*; import java.awt.*; import java.awt.event.*;