tags:

views:

19

answers:

2
+1  Q: 

JList Help Please

Hi Guys,

I have a list of data in a JList component in my GUI.

I would like to know if there is a method that i can call on the list element(s) to strike through a particular element in the list. I would like to draw a line through the element to appear as if that element is canceled.

I want a similar thing like the strike through functionality in Microsoft Word document whereby a line i drawn through the text.

thanks for your help

+1  A: 

You can apply html formating to each element of a list. Therefore if you know what element you want struck through you can modify the string held by that element as such:

<html><strike>this text will be struck through</strike></html>

Edit: I should note that I haven't tested this so if the strike tag isn't supported in Java try just s. One of those should work

Mike
Thanks for you reply. I tested the strike tag in html and it works. I will test it in my program and see if it will work.
kap
+1  A: 

JIDE Common Layer has a StyledListCellRenderer that can be used to provide this functionality.

Mark