Sounds like you may be better off implementing a JTextField in combination with a PopupMenu. There you can use the menu separator. Pack them together into a custom component and you will be able to use it just like a JComboBox.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
Not here, and not now. Actually for this exact type of thing, not at all any more. If I still had access to the code from certain parts of the last project I worked on I would have something very similar, but I don't.
Here is the design idea.
Start with a JPanel implementing ActionLisitener
Add an ArrayList (or something else to act as the DataModel)
Add a JTextField
Add a button to the Left that opens a popupmenu
The Action Listener takes the selected menu item, adds it to the JTextfield and fires an ItemEvent
There are a few tweaks still to make, but that is the gist.
Have Fun.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494
First, this is two years old, I doubt he's waiting any more. Second, don't forget that then the separator is also selectable and that he will have to add some hooks to either prevent it's selection actually doing anything, or better yet that it can't be selected at all, and then you're right back to about the same amount of work as the other possibilty.
masijade
Industrious Poster
4,253 posts since Feb 2006
Reputation Points: 1,471
Solved Threads: 494