How to give space in between JList cell.

I am using JList to display the list of images  in JList.HORIZONTAL_WRAP. But there the no space between the two images.
How can i give the space between the images in both horizontal and vertical direction . Is there any method to set inter cell space of JList.
Computer07Asked:
Who is Participating?
 
objectsConnect With a Mentor Commented:
try:

renderer.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, Color.white));
0
 
CEHJCommented:
You still need a custom renderer (see last) but you could add a Border to the image
0
 
objectsCommented:
renderer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
0
 
Computer07Author Commented:
hi object,
I have tried your code,  but when i selects icon, selection color appears in border area also, so when we select next icon , we can feel there is no space between icons.

 cant we make the selection area smaller.
0
 
CEHJCommented:
?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.