PropertyChangeHandling

Questions on using RSyntaxTextArea should go here.

Moderator: robert

PropertyChangeHandling

Postby Guest » Sun Mar 17, 2013 1:52 pm

I've got one question, in which class are you handling all the property change events from rsta? I cannot find the class....
Guest
 

Re: PropertyChangeHandling

Postby robert » Sun Mar 17, 2013 3:59 pm

I'm not sure what you're asking. RSTA fires a number of PropertyChangeEvents itself, but doesn't handle any directly by itself. You can search the project for "void propertyChange" to find any PropertyChangeListeners in the source code.
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm

Re: PropertyChangeHandling

Postby Guest » Thu Mar 21, 2013 7:53 pm

Ah ok ... I've got also another question: of I create a jmenuitem with the action rtextarea.getAction(rtextarea.undo_action)) and I try to GET the short description via string desc = (String) action.getvalue(Action.Shortcut_description) I receive a nullpointerexception, why?
Guest
 

Re: PropertyChangeHandling

Postby robert » Fri Mar 22, 2013 1:41 am

The shared actions used in the RSyntaxTextArea context menu are not exactly the best design. To grab one, you have to instantiate an instance of RSyntaxTextArea first. This is because they're lazily created when the first RSTA instance is created.
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm

Re: PropertyChangeHandling

Postby Guest » Fri Mar 22, 2013 3:00 pm

Ah thats the reason ^^ and how can o update them? If I create them on a jmenu you can always click on them. So I want that the "listen" to the focused rsta
Guest
 

Re: PropertyChangeHandling

Postby robert » Fri Mar 22, 2013 6:09 pm

All actions used by RSTA, including those in the context menu, extend Swing's standard TextAction class, which will always operate on the last-focused text component.

You can update these actions just like any other Swing Action. Read How to Use Actions for more information. RSTA-based actions all extend RecordableTextAction as well, which provides getters and setters for the common properties if you'd rather do that instead of using Action's putValue() method.

You might also want to check out this example showing how to customize RSTA's context menu.
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 3 guests

cron