I'm trying to implement a custom ListCellRenderer; I've referred to several books and web articles, but I can't seem to get a sense of how I should do this.
The goal: each object should render as the item's name, right justified, and a metric score left justified.
e.g. Event One 100 Event Two 234 Event Three 15 etc
My first attempts were along the lines of the example in Core Java volume two, where they create a JLabel inside the getListCellRendererComponent. I tried creating two JLabels, changed the layout to a BorderLayout and inserted the JLabels. This worked for a single item list, but on multi-item lists each cell contains all the data overwriting itself. The authors of that book don't recommend this method because it's constructing new compoenents on every call.
So I tried changing to a method where the real work is done in the paintComponent method; however I have no clue as to how I'ld generate the intended effect working at the Graphics level, nor how to even figure out the getPerferredSize issues.
How should I tackle this? It doesn't feel like it should be as hard as I'm making it.