I knew that we can use:
setText("<a> href="url"> Link </a>");
to set up a link. But the output of this is underlined.
I want to have a link that is not underlined, so I tried
setText(<a> href="url" style="text-decoration: none" Link </a>);
But it still doesnt work. Any HELP?
Well, you cannot remove the underline. It is drawn internally with the help of the TextLayout class and there is no way to influence the behavior. By the way the HTML code for the text widget is only used internally for parsing. There is actually no HTML support for the Link widget. This is why the style attribute doesn't work. You can however use the StyledText widget for more advanced text layout.
Just to add to Tobias Willig's answer, if your are working with JFace and Forms then you can use org.eclipse.ui.forms.widgets.Hyperlink and its setUnderlined(). You can see a working example here: Custom Components
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With