Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes help in Textarea as i thought Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "help in Textarea as i thought" Watch "help in Textarea as i thought" New topic

help in Textarea as i thought

Maged Roshdy

Joined: Feb 08, 2003
Posts: 24
i try to change my font,color and size wherever
i want in my textarea .
but i the only methods i found is setForground()
and setFont() that change in the holl textarea.
thanks in advanece
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Then you need to subclass TextArea and build in that functionality.

"JavaRanch, where the deer and the Certified play" - David O'Meara
Ashish Mahajan
Ranch Hand

Joined: Feb 19, 2003
Posts: 77
Hi Maged,
Have u tried using TextPane It's made for that only :-)
As Cindy said u can develop subclass of JTextArea also for the same reason. In my opinion, if the requirement is full fledged Word Processor then use JTextPane or if a simple developer's editor (syntax highlighting etc..) is to be developed then subclass JTextArea's ui BasicTextAreaUI and create ur own custom View which extends PlainView in create(Element) method. Just see the source code of PlainView class, the rest is fairly simple.

The best teams have no specialists, only general contributors with special skills
I agree. Here's the link:
subject: help in Textarea as i thought
jQuery in Action, 3rd edition