On 8/5/2013 6:44 PM, Kevin Connor Arpe wrote:
Tom,
[ Apologies for my late reply. I forgot to confirm original request
for mailing list subscribe. Duh. ]
I agree with your reasoning. It makes sense. Can I submit a
Javadoc-only patch for widgets with text labels?
Make sure that you signed the Oracle Contributor Agreement before
contributing to the Open JDK:
http://openjdk.java.net/contribute/
Examples: JLabel & AbstractButton subclasses: ctors + .setText(String)
Maybe I could point people here:
http://docs.oracle.com/javase/tutorial/uiswing/components/html.html
And make a reference to BasicHTML.isHTMLString(String) ... and update
its docs to explain the match algo -- very precise, intentionally.
Re: "client property", are you referencing BasicHTML.htmlDisable?
Ref:
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7-b147/javax/swing/plaf/basic/BasicHTML.java#BasicHTML.0htmlDisable
Woah, if so, that is pretty deep in the woods. It would be nice if
there was a method to toggle that feature on relevant widgets.
Perhaps few others have found this rather esoteric feature reference &
docs. Making the connection from a ctor or method setText(String) on
a widget to BasicHTML was a leap for me... and then I missed this
interesting and important feature via "htmlDisable". Maybe some docs
to help point the way? I only found this stuff by digging through the
OpenJDK source code.
I agree that the better idea is to have a client property like
"treat text as html" that allows to not break the backward compatibility.
Thanks,
Alexandr.
Thanks,
Arpe
>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