Thread: JList issues
View Single Post
  #5 (permalink)  
Old 09-11-2008, 12:27 AM
hardwired's Avatar
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,577
Rep Power: 4
hardwired is on a distinguished road
Default
How can I reduce the width of the selected item.
The JList api has setFixedWidth/Height methods you could use to move the list items closer together.
If you want the selectionColor to cover only the rectangle enclosing the icon and string then you may have to look at some plaf code. You might start with the paintImpl and paintCell methods in the BasicListUI class. You could try calculating the rectangle union of the icon and text rectangles and paint it in the backgroundSelection color.
Reply With Quote