RTextArea needs ConfigurableCaret

Questions on using RSyntaxTextArea should go here.

Moderator: robert

RTextArea needs ConfigurableCaret

Postby Stefan1 » Wed Oct 31, 2012 12:56 pm

Hello,

whenever I type a ^-character I get a java.lang.IllegalArgumentException with the following message:
RTextArea needs ConfigurableCaret

What can I do to remedy this?

Greetings
Stefan
Stefan1
 

Re: RTextArea needs ConfigurableCaret

Postby robert » Wed Oct 31, 2012 1:28 pm

Only when you type '^'? If so, that's very strange. Did you set a custom Caret in your RTextArea/RSyntaxTextArea? It requires its Caret to subclass ConfigurableCaret.
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Re: RTextArea needs ConfigurableCaret

Postby Stefan1 » Wed Oct 31, 2012 5:08 pm

Hi Rob,

yes, as of now the problem only occurs, when I type a ^-character.

I did not set a custom Caret. Do you have an example on how to do it?

How would a custom Caret work? Highlight, like in other editors, the ^-character as long as no second character is entered?

Stefan
Stefan1
 

Re: RTextArea needs ConfigurableCaret

Postby robert » Thu Nov 01, 2012 12:25 pm

Sorry, I'm not suggesting for you to use a custom Caret, I meant that if you were using one, it had to extend CustomCaret or you'd get an exception like the one you posted.

Please post a short, compilable example that demonstrates the behavior you see. For example, can you successfully type a caret character in the editor if you compile and run this example program?
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Re: RTextArea needs ConfigurableCaret

Postby Stefan1 » Thu Nov 01, 2012 2:12 pm

If I run your sample program I still get the following exception:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: RTextArea needs ConfigurableCaret
at org.fife.ui.rtextarea.RTextArea.setCaret(RTextArea.java:1312)
at javax.swing.text.JTextComponent.exchangeCaret(JTextComponent.java:4887)
at javax.swing.text.JTextComponent.setInputMethodCaretPosition(JTextComponent.java:4857)
at javax.swing.text.JTextComponent.processInputMethodEvent(JTextComponent.java:4481)


Stefan
Stefan1
 

Re: RTextArea needs ConfigurableCaret

Postby robert » Fri Nov 02, 2012 12:36 pm

By chance, are you entering text in an Asian locale? There's an open issue with RSTA where certain Chinese (I believe) characters cause JTextComponents to automatically switch out their caret for a RTL-aware Caret, which breaks RSTA.
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Re: RTextArea needs ConfigurableCaret

Postby Stefan1 » Thu Nov 08, 2012 7:34 pm

No, no Asian locale.

But I should mention that I get this error on Mac OS X. I just tested the tool on Windows - and there I did not get the error!
Stefan1
 

Re: RTextArea needs ConfigurableCaret

Postby robert » Sun Nov 11, 2012 4:29 am

Hopefully it isn't a problem on all Macs. Unfortunately, I've been without a Mac to test on for months now. I hope to get one soon, which will give me a test case.

Just so I have all the details, I assume this is the last Apple JDK? Or are you using OpenJDK?
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Re: RTextArea needs ConfigurableCaret

Postby stefan1 » Fri Nov 16, 2012 11:19 pm

Java(TM) SE Runtime Environment (build 1.6.0_35-b10-428-10M3811)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01-428, mixed mode)

Stefan
stefan1
 

Re: RTextArea needs ConfigurableCaret

Postby robert » Sat Nov 17, 2012 3:51 pm

I just blew some money on a shiny new Macbook Pro, and I don't see this problem with either the 2.0.0 release in the applet demo, or with the latest in the SVN trunk. So I'm somewhat at a loss here.

I *could* try changing setCaret() so that, instead of throwing an exception on receiving a non-ConfigurableCaret, we instead simply ignore the Caret change. There is a small chance that this might break other Swing-internal stuff (though I doubt it, but there are still a few hard-coded dependencies and other bits of fun in Swing).

If I cobble this up for you, can you test it out for me and report back if it fixes your problem, and if you see any side effects from it?
User avatar
robert
 
Posts: 802
Joined: Sat May 10, 2008 5:16 pm

Next

Return to Help

Who is online

Users browsing this forum: No registered users and 7 guests

cron