We help IT Professionals succeed at work.

How to give space in between JList cell.

Computer07
Computer07 asked
on
2,645 Views
Last Modified: 2013-11-24
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.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
You still need a custom renderer (see last) but you could add a Border to the image
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
renderer.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

Author

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.
Java Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2016

Commented:
?
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.