Line alignment RSyntaxTextArea and RTextScrollPane

49 Views Asked by At

In my code I'm using RSyntaxTextArea and RTextScrollPane but the line numbers of the RTextScrollPane are not perfectly aligned with the lines of the RSyntaxTextArea.

Here is my code :

RSyntaxTextArea tabTextArea = new RSyntaxTextArea();
tabTextArea.setSyntaxEditingStyle(SyntaxConstants.SYNTAX_STYLE_JAVA);
tabTextArea.setCodeFoldingEnabled(true);
tabTextArea.setAntiAliasingEnabled(true);

RTextScrollPane tabScrollPane = new RTextScrollPane(tabTextArea);
tabScrollPane.setLineNumbersEnabled(true);
tabScrollPane.getGutter().setSpacingBetweenLineNumbersAndFoldIndicator(10);

I've also changed the font in another part of the code, here are the parts where I made these :

For the RTextScrollPane (fontText is "OCR A Extended") :

((RTextScrollPane) (((SwingNode) tab.getContent()).getContent())).getGutter().setLineNumberFont(new Font(fontText, Font.PLAIN, 14));

For the RSyntaxTextArea (OCR_FONT_FAMILY is same as fontText) :

rSyntaxTextArea.setFont(new Font(OCR_FONT_FAMILY, Font.PLAIN, 14));

It's the same font and same size but it's not aligned. Can someone help me ? And an important important information is that if I do not set theses font it's perfectly aligned.

Thanks !

0

There are 0 best solutions below