aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Changin font in a JTextArea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Changin font in a JTextArea" Watch "Changin font in a JTextArea" New topic
Author

Changin font in a JTextArea

Richard Robbins
Ranch Hand

Joined: Mar 07, 2001
Posts: 66
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?


Richard Robbins is one of the founders of WebsiteTemplateDatabase.com, a resource for free website templates and Photoshop tutorials. He also consults for an online boutique selling baptism dresses and christening gowns.
Paul Stevens
Ranch Hand

Joined: May 17, 2001
Posts: 2823
setFont() method.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Richard,
Look at javax.swing.text.Document and its children.
Regards,
Manfred.
Sajee Joseph
Ranch Hand

Joined: Jan 17, 2001
Posts: 200
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
 
 
subject: Changin font in a JTextArea
 
Similar Threads
How to make Resize JButton() on mouse click...
Question about back button in browser
Input text in each row of JSF datatable not getting updated while submitting
changing txt value of a button in SWT
Is JGoodies Look and Feel not support Chinese language?