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?
Many bugs have been reported against the
deriveFontmethods; see this search. I could not spot one that exactly matched your problem, but you could have better luck. If you find a relevant bug report, there may be a workaround.