Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Dashed underline Font problem  RSS feed

 
jack morton
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I create the following font :

My problem is the dashed line doesn't scale with the font size
How to resolve that
 
Brian Cole
Author
Ranch Hand
Posts: 937
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jack morton wrote:
I create the following font :

My problem is the dashed line doesn't scale with the font size
How to resolve that


I haven't played with AttributedCharacterIterator attributes much, but I'm surprised you get a dashed line at all. First, wouldn't you need attributes.put(UNDERLINE, UNDERLINE_ON)? More importantly, I'm pretty sure java.awt.Font ignores underline attributes (and other "non-fonty" attributes such as the ones that deal with color) anyway.

One quick way to get underline would be to do setText("<html><u>Text"), though I'm not sure how well that scales with large font sizes.

btw, I think you're going to run into trouble with your code unless you change the 50 to something like 50f or Float.valueOf(50), or else it will put an autoboxed Integer in the map where a Float would be expected.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!