Showing the current selected item in a JList once a ListCellRenderer has been added.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Stephen_Smith
Posted On:   Sunday, August 3, 2003 05:46 PM

Hi, I've got a JList with a KeyListener and MouseListener. The user is able to scroll down the list using the mouse or keyboard, and double-click or press ENTER if they want to view a particular item.


However, if I add a ListCellRenderer to the JList, I can no longer see the currently selected item if I navigate using the keyboard or mouse! Is there a way around this?


Thanks, Steve.

Re: Showing the current selected item in a JList once a ListCellRenderer has been added.

Posted By:   Stephen_Smith  
Posted On:   Monday, August 4, 2003 07:59 AM

Sorry, fixed this one myself! list.setForeground(list.getSelectionForeground()) was far too obvious for 0200. :)
About | Sitemap | Contact