JButton rendered with HTML text takes longer to load

I have a JButton that displays text rendered in HTML.

ie. JButton but1 = new JButton("<html><STYLE=\"font-family: Dialog; font-size: 12pt\"><center>Current

Date</center></STYLE></html>");

The reason for the STYLE tag is so that the font matches the rest of the application (instead of defaulting to Times New Roman).

As a result of including the HTML tags, the dialog containing the panel with my buttons takes noticeably longer to load (especially when it's my login dialog).

Does anyone know why this takes longer to render or if there is some way around it?

Interesting to note: One unexpected outcome of using the HTML tags is that it sets all my buttons to the same width (they are in a BoxLayout.Y_AXIS layout), whereas before, they refused to have their size set at all and were all different.

[922 byte] By [beckwest] at [2007-9-26 1:44:59]
# 1

Okay, well I worked out a way around my problem - don't use HTML.

The only reason I was using HTML was to allow me to have multi-line buttons. Using HTML also had the added problem of the text not showing the enabled-state of the button (ie. the text did not appear disabled) or the Mnemonic.

I have created a subclass of JButton that creates multiple lines using JPanels instead of HTML.

beckwest at 2007-6-29 2:40:58 > top of Java-index,Archived Forums,Swing...
# 2
beckwest,I had the same problem when using html tag in a JButton (it took too long to load it up). Do you think you can offer me the code of creating multiple lines JButton without using html tag? If so I appreciate very much.javamesser
javamesser at 2007-6-29 2:40:58 > top of Java-index,Archived Forums,Swing...
# 3
http://developer.java.sun.com/developer/JDCTechTips/2002/tt0723.html#tip2
camickr at 2007-6-29 2:40:58 > top of Java-index,Archived Forums,Swing...