How can i underline a text in JDK5, NOT JDK6

Posted by Serkan Kasapbasi on Stack Overflow See other posts from Stack Overflow or by Serkan Kasapbasi
Published on 2010-04-29T14:55:04Z Indexed on 2010/04/29 14:57 UTC
Read the original article Hit count: 313

Filed under:
|

when i search internet i have found a way to underline font like this,

Font f=jLabel1.getFont();
Map<TextAttribute,Object> map = new Hashtable<TextAttribute,Object>();
map.put(TextAttribute.UNDERLINE,TextAttribute.UNDERLINE_ON);
f=f.deriveFont(map);
jLabel1.setFont(f);

it works well on jdk6, however it doesnt work on jdk5, and it doesnt warn about anything. first, how can i get same effect on jdk5? second, why is there a TextAttribute.UNDERLINE constant, if it doesnt work?

© Stack Overflow or respective owner

Related posts about swing

Related posts about java