views:

247

answers:

2

I am scrapping data from web site using my java application and want to display the result after parsing code of html page in a Text Area made in Swing.

Text like: hello <b>every</b>one should be displayed as: 'hello everyone' in text area. Thanks!!

A: 

There is no way to see formated text inside of textarea( text in name of tag mean text not html). If you don't need to submit code inside area - you can use some style magic for div element. If you need to submit - use some WYSIWYG editor. There is free one FCK

Artic
+2  A: 

You can use a JEditorPane to display HTML or a JTextPane, which allows you to set attributes for specific characters. Read the API and you will find a link to the Swing tutorial which provides examples.

camickr
Just a note: JEditorPane is good for relatively simple HTML and CSS but cannot display everything correctly like a decent modern browser can. Various versions of Java have slowly improved it but it is still not 100%. Sun announced a new component called JWebPane that is based on WebKit but so far it is vapourware.
Avrom