开发者

JList strike through

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.

th开发者_如何学编程anks for your help


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜