Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with drawing styled (attributed) text

 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the following two code excerpts. First of them works OK, but the second does not. Why? They are almost same.





What is the problem? Is it a bug?
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No idea???
 
Craig Wood
Ranch Hand
Pie
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This works okay.
 
Velika Srbija
Ranch Hand
Posts: 172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, it doesn't work. The string "1,2" is not subscripted.

Also, there is an error in the line:

astr.addAttribute(TextAttribute.SIZE, 36f);

It should be:

astr.addAttribute(TextAttribute.SIZE, new Float(36));
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic