Wednesday, April 6, 2011

SWT Link Text with >

I am trying to create a SWT Link with the text so it looks like the following

<this is the link>

where the text this is the link is the actual link.

I can get close with the following code:

link.setText("<a><this is the link></a>");

However, I want just the text to be the link, and not include the < and >. I thought I could do it simply by doing:

link.setText("<<a>this is the link</a>>");

But when I do that - I lose the ending >. Can anyone think of how to get the > back (without it being part of the link?

Thanks

From stackoverflow
  • What version of SWT are you testing with? When I run the first SWT sample snippet for Link, but replace the text with your sample

    link.setText("<<a>this is the link</a>>");
    

    then I see what I believe you want to see. This is with SWT 3.3.2.

  • This seems to do the trick:

    link.setText("<<a>this is the link</a>> >");
    

0 comments:

Post a Comment