I wouldn't want the html detection to be any more lenient. It's already problematic in that programmers need to ensure that they don't allow user text to switch modes. Whilst it's best to do this with the client property, that isn't always done in practice. Currently it just requires that whoever edits the text uses the correct form, with any errors being obvious.

Tom

On 26/07/2013 12:27, Kevin Connor Arpe wrote:
Hello,

This is my first post to this mailing list.

I was playing around with HTML + text labels on Swing widgets today.  I
noticed that the sniff test for HTML is defined by this static method:
javax.swing.plaf.basic.BasicHTML.isHTMLString(String)

The test is quite strict.  Basically, the string must start with
"<html>" -- no whitespace allowed, but it is case insensitive.

If there is a good reason for this strictness, please let me know.
Otherwise, I would like to submit a small patch (+ test) to improve this
static method to be more forgiving.  If OK, please also advise about
JDK7u vs JDK8.  (I don't know if a [simple] patch can be applied to both
releases easily.)

In Perl regex parlance, something like: m/\s*<html\s*>/i
Of course, my solution probably wouldn't use a regex, nor Perl. =)

Please share you thoughts.

Thanks,
Kevin Connor ARPE
Hongkong

Reply via email to