Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #318

Re: disable html parsing

From "Daniel" <daniel@THRWHITE.remove-dii-this>
Subject Re: disable html parsing
Message-ID <02s7n29sk3i31ue7dr3k2qbd85rb5revkk@4ax.com> (permalink)
Newsgroups comp.lang.java.gui
References <4572d86e$0$8742$ed2619ec@ptn-nntp-reader02.plus.net>
Date 2011-04-27 15:26 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui


>Andrew Thompson wrote:
>> Daniel wrote:
>> ...
>>> A few cells contain <html> and more text that is used in the program
>>> it is editing the messages for.
>>>
>>> I would like to disable the default cell renderer from parsing the
>>> html and instead display "<html> here is multi <br> line text </html>"
>>> Is this possible?
>
>> class NonHTMLLabel extends JLabel {
>>   NonHTMLLabel(String label) {
>>     super("<html>" + label.replaceAll("<", "&lt;"));
>>   }
>> }
>
>And replace & with &amp; (first), and other differences.
>
>> Note: there may be better solutions, above is just
>> 'one way'.
>
> From 1.5, I believe you can do:
>
>     label.setClientProperty("html.disable", true);

Excellent! It worked perfectly, thank you very much!
I was looking in the API for something along those lines, but I could
not find it. I guess I did not dig deep enough, again thank you!


regards
Daniel

>
>http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4652898
>
>For 1.4, I guess preppend a zero width no-break space (a.k.a. byte order 
>mark, BOM). So:
>
>     new JLabel("\ufeff"+text)
>
>
>Exporting table data as HTML is also something you want to avoid the 
>default PL&F behaviour for (unless you like XSS).
>
>Tom Hawtin

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

Re: disable html parsing "Thomas Hawtin" <thomas.hawtin@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000
  Re: disable html parsing "Daniel" <daniel@THRWHITE.remove-dii-this> - 2011-04-27 15:26 +0000

csiph-web