Selected text color

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Selected text color

Postby E.Fil » Tue May 26, 2009 11:17 am

Hi,

I wanted to know if it was possible to set a selected text color that was visible when the RSyntaxTextArea was not the component with the focus.

Use case:
1 RSyntaxTextArea with several commands (like sql or some other)
1 other object with command result
when I don't select any text on the RSyntaxTextArea, the app run the hole text as a command, when I select only part of the text, it runs only that selection as a command.
The thing is, I wanted that selection to still be visible when I changed the focus to some other object, like the results.

Is there a way to do this?

Thks
E.Fil
 

Re: Selected text color

Postby robert » Tue May 26, 2009 7:55 pm

Thanks for the feedback. You're right - this is annoying. I think RSTA used to always show the selection, but then after some refactoring, it no longer does so (which is the default Swing text component behavior). I'll fix this ASAP.

In the mean time, I think you can work around this by doing the following when creating your text area.

Code: Select all
RSyntaxTextArea textArea = new RSyntaxTextArea(...);
textArea.setCaret(new org.fife.ui.rtextarea.ConfigurableCaret() {
   public void setSelectionVisible(boolean visible) {
      // Always keep selection visible
      super.setSelectionVisible(true);
   }
});
User avatar
robert
 
Posts: 803
Joined: Sat May 10, 2008 5:16 pm

Re: Selected text color

Postby E.Fil » Wed May 27, 2009 9:31 am

Hi,

Thanks, that did the trick. :)
E.Fil
 


Return to Help

Who is online

Users browsing this forum: No registered users and 5 guests

cron