Lost in the docs again: JTextArea and EditorKit

Greetings,

As the topic title says: I lost track again in the Swing classes docs.

I'm about sure a JTextArea (as well as a JTextComponent) uses a

DefaultEditorKit, which in turn extends an EditorKit. I want that object

because it carries some nice functionality I want to use.

How, by Jove, can I get a reference to a JTextArea's EditorKit? Any pointers

or clarifications are more than welcome because I'm also sure that I'm

missing something in the MVC separation.

kind regards,

Jos

[548 byte] By [JosAHa] at [2007-11-26 16:14:52]
# 1
textComponent.getUI().getEditorKit( textComponent );
camickra at 2007-7-8 22:37:46 > top of Java-index,Desktop,Core GUI APIs...
# 2

> textComponent.getUI().getEditorKit(textComponent );

Hrmph; why do your replies always make me feel like a blind

incompetent fool? ;-) I thought I've been there but obviously I don't

understand the 'mechanism' of this all.

btw, thanks a bunch for your informative reply; it helped me out, much appreciated.

kind regards,

Jos (< blind nincompoop ;-)

JosAHa at 2007-7-8 22:37:46 > top of Java-index,Desktop,Core GUI APIs...
# 3

> I thought I've been there but obviously I don't understand the 'mechanism' of this all.

I don't really understand the mechanism either. I was confused why JTextPane and JEditorPane have a getEditorKit() method and JTextArea doesn't. It seems to me that the method should be defined in JTextComponent and overriden if necessary.

Anyway I ended up searching the code to see where "editorkit" was used. Thats my trusty fallback.

camickra at 2007-7-8 22:37:46 > top of Java-index,Desktop,Core GUI APIs...
# 4

> > I thought I've been there but obviously I don't

> understand the 'mechanism' of this all.

>

> I don't really understand the mechanism either. I was confused why

> JTextPane and JEditorPane have a getEditorKit() method and JTextArea

> doesn't. It seems to me that the method should be defined in JTextComponent

> and overriden if necessary.

>

> Anyway I ended up searching the code to see where "editorkit" was

> used. Thats my trusty fallback.

You're right, I should've done that too instead of just digging into the api

docs. Sorry for saying so, but those Swing apis are quite inconsistent,

if not incomplete, at several occasions. I always come here when I get

stuck with them. Anyways, thanks again for doing what I should've done

in the first place ;-)

kind regards,

Jos

JosAHa at 2007-7-8 22:37:46 > top of Java-index,Desktop,Core GUI APIs...
# 5
The whole Swing text API is infuriatingly opaque. There have been many times when a question came up (either in these forums or in my own work), and I thought I could do a quick check and snag the answer, because I had solved a very similar problem before. Three hours later...
uncle_alicea at 2007-7-8 22:37:47 > top of Java-index,Desktop,Core GUI APIs...