listcellrenderer

Wrong background colors in Swing ListCellRenderer

I'm currently trying to write a custom ListCellRenderer for a JList. Unfortunately, nearly all examples simply use DefaultListCellRenderer as a JLabel and be done with it; I needed a JPanel, however (since I need to display a little more info than just an icon and one line of text). Now I have a problem with the background colors, speci...

Custom Java ListCellRenderer - Can't click JCheckBox

Made a custom ListCellRenderer: import java.awt.Component; import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.ListCellRenderer; /** * * @author Spencer */ public class TaskRenderer implements ListCellRenderer { private Task task; private JPanel p...

Java Custom ListCellRenderer casting problem (SSCCE included)

Hello all, I am trying to create a custom ListCellRenderer in order to give different foreground colors in each line, depending on the input of the jList. I am not an expert or anything, but I really can't figure this out. I get a casting error: Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast ...