tags:

views:

254

answers:

2

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

A: 

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.

Eddie
Tried the following code - but it resulted in 'lt;this is the linkgt;'
A: 

This seems to do the trick:

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