Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Fixed font in java  RSS feed

 
Chandhrasekar Saravanan
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am displaying text in an scroll pane. i am
presently using "Dialog" font with font size of 12 . i have to display all the text in fixed font, do i need to change the entire font itself or just need to do some modification using fontmetrics .
Thanks
Regards
Chandhrasekar Saravanan
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean that you need to use a fixed-width font? The easiest way to do this is to set the font to a "Monospaced" font... look at the example below :

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!