This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Changin font in a JTextArea  RSS feed

 
Richard Robbins
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing a Swing application in which input into a JText Area can be done in two ways: typing the text in directly, and pressing a button. I want the font of the text entered when using the button to be different from the font used when typing the text in directly. How do I do this?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setFont() method.
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Richard,
Look at javax.swing.text.Document and its children.
Regards,
Manfred.
 
Sajee Joseph
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I dont think JTextArea will help u. Though u can change the font using setFont(), but u can't have a JTextArea with text in different fonts. Better use JTextPane. JTextPane supports different fonts and colors too.
..regards
...saj
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!