• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

graphics2d drawString

 
Evan Pierce
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how i was wonder how when i called drawString i could set the size of the font? ive been looking all over for a comand like setFontSize or something but no luck. can anyone school me?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to call setFont before calling drawString. That allows you to specify the font, the font size, and some font attributes like bold/plain/italics.
 
Evan Pierce
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok but the only setFont i see is setFotn(font). i dont see one that takes these other arguments you speak of. what are the arguments for the setFont you are speaking of?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the javadocs, click on the "Font" parameter of drawString. That should take you to the javadocs of the Font class. In particular, check out the Font(String,int,int) constructor.
 
Evan Pierce
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
o i get it, i need to load a font and i set those attributes while making that font. gotcha. thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic