-1

As the title says - I am trying to figure out a way to make a small gap, say 5 pixels, between the line separating line numbers and the source code in a RSyntaxTextArea instance of my editor. I was looking at the API and found nothing...

NOTE: I am using the latest version available on Maven central - v2.5.3.

Here is a simple demo where you can see how close the gap is: enter image description here

Paul Samsotha
  • 205,037
  • 37
  • 486
  • 720
DejanLekic
  • 18,787
  • 4
  • 46
  • 77
  • What does `setMarginLinePosition(getMarginLinePosition() + 2);` do? – Joop Eggen Nov 11 '14 at 12:22
  • It moves the vertical line 2px to the right. – DejanLekic Nov 11 '14 at 12:29
  • Maybe setting the margin line's color to the background colour which would give a 1 px gap is sufficient in combination with the margin line position. – Joop Eggen Nov 11 '14 at 12:34
  • OK, I was too fast with writing the question... - I found out the way to do this by simply using JTextArea's setMargin() method... Silly me, I forgot RSyntaxTextArea is basically JTextArea on steroids. :) `Insets insets = textArea.getMargin(); insets.left = 5;` did the job. – DejanLekic Nov 11 '14 at 12:34
  • Make it an acceped answer, or maybe retract your question. – Joop Eggen Nov 11 '14 at 12:43

1 Answers1

-1

I was too quick to ask the question... RTextAreaBase provides the getMargin() and setMargin() methods that can be used to change the insets of the component.

The following simple line increases the gap:

// Increase the gap between the (vertical) margin line and the source code.
Insets in = textArea.getMargin();
textArea.setMargin(new Insets(in.top, in.left + 5, in.bottom, in.right)); 
DejanLekic
  • 18,787
  • 4
  • 46
  • 77