Added getLineText

This commit is contained in:
Konloch 2021-06-27 17:02:56 -07:00
parent cc45227208
commit 10950a71da

View file

@ -9,6 +9,7 @@ import the.bytecode.club.bytecodeviewer.gui.components.listeners.ReleaseKeyListe
import the.bytecode.club.bytecodeviewer.util.JTextAreaUtils;
import javax.swing.*;
import javax.swing.text.BadLocationException;
import java.awt.*;
import java.awt.event.KeyEvent;
@ -89,6 +90,17 @@ public class SearchableRSyntaxTextArea extends RSyntaxTextArea
JTextAreaUtils.highlight(this, pattern, caseSensitiveSearch);
}
public String getLineText(int line) {
try {
if (line < getLineCount()) {
int start = getLineStartOffset(line);
int end = getLineEndOffset(line);
return getText(start, end - start).trim();
}
} catch (BadLocationException ignored) { }
return "";
}
public RTextScrollPane getScrollPane()
{
return scrollPane;