有一个简短的教程示例,展示了如何在java2s上使用自定义ListCellRenderer
http://www.java2s.com/Code/Java/Swing-
Components/BlockComboBoxExample.htm
基本上,这涉及在列表模型中插入一个已知的占位符,并且当您在ListCellRenderer中检测到占位符时,将返回“ new
JSeparator(JSeparator.HORIZONTAL)”的实例。

有一个简短的教程示例,展示了如何在java2s上使用自定义ListCellRenderer
http://www.java2s.com/Code/Java/Swing-
Components/BlockComboBoxExample.htm
基本上,这涉及在列表模型中插入一个已知的占位符,并且当您在ListCellRenderer中检测到占位符时,将返回“ new
JSeparator(JSeparator.HORIZONTAL)”的实例。