Problem in displaying error icon

Questions on using RSyntaxTextArea should go here.

Moderator: robert

Problem in displaying error icon

Postby ramesh » Mon Jul 13, 2009 11:19 am

Hi,

Here is what I did to display the error icon along the line numbers.

Code: Select all
...
errorIcon = new ImageIcon(SQLEditorApplet.class.getResource("/Error.png"));
scrollPane.getGutter().addLineTrackingIcon(argRow, errorIcon);
...


But I don't see the icon in my editor. Anything wrong in the above lines ?

Thanks,
Ramesh S
ramesh
 
Posts: 7
Joined: Wed Jun 24, 2009 9:53 am

Re: Problem in displaying error icon

Postby robert » Mon Jul 13, 2009 8:43 pm

Try adding this:

Code: Select all
scrollPane.getGutter().setIconRowHeaderEnabled(true);


or even just:

Code: Select all
scrollPane.setIconRowHeaderEnabled(true);


I think without this, the icon area will never be visible. It isn't smart enough to automagically display itself if an icon is added (yet :)).

If you also want automatic bookmarking (e.g. pressing F2 moves the caret to the next bookmark) on single-clicks in the gutter, you can do this:

Code: Select all
scrollPane.getGutter().setBookmarkIcon(myIcon); // Have to set an icon to use first
scrollPane.getGutter().setBookmarkingEnabled(true);


Enabling bookmarking will automatically make the icon area visible (as bookmark icons and your own icons are rendered onto the same component). But if bookmarks aren't your cup of tea, you can just call setIconRowHeaderEnabled() yourself.

I'm impressed you dug this stuff up yourself, I don't think it's documented anywhere! I really need to get some new examples up, for stuff like this and auto-completion.
User avatar
robert
 
Posts: 797
Joined: Sat May 10, 2008 5:16 pm

Re: Problem in displaying error icon

Postby ramesh » Tue Jul 14, 2009 10:39 am

Thank you for that tip. It is working now.
ramesh
 
Posts: 7
Joined: Wed Jun 24, 2009 9:53 am


Return to Help

Who is online

Users browsing this forum: No registered users and 4 guests

cron