Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » HTML text rendering in a text widget (like JLabel in Swing)?
HTML text rendering in a text widget (like JLabel in Swing)? [message #461263] Mon, 19 September 2005 22:27 Go to next message
Nadeem Aboobaker is currently offline Nadeem AboobakerFriend
Messages: 20
Registered: July 2009
Junior Member
Hey all,

I have a string that contains HTML text formating tags, such as bold,
italic and line break and would like to display the properly formatted
string in a SWT app.

After searching around and asking some people, I haven't found any SWT
widget that makes this easy, like JLabel in Swing. For instance, I've found
that I can use StyledText/StyleRange to display a string with different font
styles and colors, but getting StyleRange from HTML seems like it might be
difficult.

Before setting out on a difficult task of rolling my own, I want to make
sure there isn't something easy I'm overlooking. Any help?

Thanks,
Nadeem
Re: HTML text rendering in a text widget (like JLabel in Swing)? [message #461277 is a reply to message #461263] Tue, 20 September 2005 11:23 Go to previous messageGo to next message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
You could reuse the HTML2TextReader that Eclipse is using to render JavaDoc
in the Hovers.

It is using StyledText and StyleRanges as well and supports basic Font
styles
and paragraphs.

Ben
> Hey all,
>
> I have a string that contains HTML text formating tags, such as bold,
> italic and line break and would like to display the properly formatted
> string in a SWT app.
>
> After searching around and asking some people, I haven't found any SWT
> widget that makes this easy, like JLabel in Swing. For instance, I've found
> that I can use StyledText/StyleRange to display a string with different font
> styles and colors, but getting StyleRange from HTML seems like it might be
> difficult.
>
> Before setting out on a difficult task of rolling my own, I want to make
> sure there isn't something easy I'm overlooking. Any help?
>
> Thanks,
> Nadeem
>
>
>
Re: HTML text rendering in a text widget (like JLabel in Swing)? [message #461279 is a reply to message #461277] Tue, 20 September 2005 11:08 Go to previous messageGo to next message
Henrik Skovgaard is currently offline Henrik SkovgaardFriend
Messages: 84
Registered: July 2009
Member
> You could reuse the HTML2TextReader that Eclipse is using to render
> JavaDoc
> in the Hovers.

How? I get a message that it's not visible.

Do you have a quick example?

:) Henrik
Re: HTML text rendering in a text widget (like JLabel in Swing)? [message #461290 is a reply to message #461263] Tue, 20 September 2005 12:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Nadeem Aboobaker" <nadeem.aboobaker@bea.com> wrote in message
news:dgne1a$o33$1@news.eclipse.org...
> Hey all,
>
> I have a string that contains HTML text formating tags, such as bold,
> italic and line break and would like to display the properly formatted
> string in a SWT app.
>
> After searching around and asking some people, I haven't found any SWT
> widget that makes this easy, like JLabel in Swing. For instance, I've
> found that I can use StyledText/StyleRange to display a string with
> different font styles and colors, but getting StyleRange from HTML seems
> like it might be difficult.
>
> Before setting out on a difficult task of rolling my own, I want to make
> sure there isn't something easy I'm overlooking. Any help?
>
Why don't you just use the Browser widget?
Does the widget need to be editable?
---
Sunil
Re: HTML text rendering in a text widget (like JLabel in Swing)? [message #461335 is a reply to message #461279] Tue, 20 September 2005 23:36 Go to previous message
Benjamin Pasero is currently offline Benjamin PaseroFriend
Messages: 337
Registered: July 2009
Senior Member
Ah well, I'd simply copy the entire class into your project.

Ben
>> You could reuse the HTML2TextReader that Eclipse is using to render
>> JavaDoc
>> in the Hovers.
>>
>
> How? I get a message that it's not visible.
>
> Do you have a quick example?
>
> :) Henrik
>
>
>
Previous Topic:set location of Dialog
Next Topic:improve performance of tree
Goto Forum:
  


Current Time: Thu Mar 28 23:09:22 GMT 2024

Powered by FUDForum. Page generated in 0.02057 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top