[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2237
  • Last Modified:

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.
0
Computer07
Asked:
Computer07
  • 2
  • 2
1 Solution
 
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
 
objectsCommented:
try:

renderer.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, Color.white));
0
 
CEHJCommented:
?
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now