Can I insert small image instead line number?

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Can I insert small image instead line number?

Re: Can I insert small image instead line number?

Post by as3boyan » Tue Sep 24, 2013 5:28 pm

Robert, thank you so much! :)

Re: Can I insert small image instead line number?

Post by robert » Sat Sep 21, 2013 5:53 pm

Assuming you use an RTextScrollPane (which you should, for line numbers and code folding), you can add icons that track lines or specific offsets in the document via these methods on the Gutter:

java code:

Gutter.addLineTrackingIcon(int line, Icon icon)
Gutter.addLineTrackingIcon(int line, Icon icon, String toolTip)
Gutter.addOffsetTrackingIcon(int offs, Icon icon)
Gutter.addOffsetTrackingIcon(int offs, Icon icon, String toolTip)


Example:

java code:

RSyntaxTextArea textArea = new RSyntaxTextArea(40, 25);
RTextScrollPane scrollPane = new RTextScrollPane(textArea, true);
scrollPane.setFoldIndicatorEnabled(true);
scrollPane.setIconRowHeaderEnabled(true);
Icon errorIcon = new ImageIcon(getClass().getResource(...));

// ...

textArea.setText("line 1\nline 2\nline 3");
GutterIconInfo tag = scrollPane.getGutter().addLineTrackingIcon(1, errorIcon);

Can I insert small image instead line number?

Post by as3boyan » Fri Sep 20, 2013 4:12 pm

You know many IDEs shows bug, like small image placed on line number place. Maybe this is possible to do this via some custom renderer or something?

Top

cron