Added getLineText
This commit is contained in:
parent
cc45227208
commit
10950a71da
1 changed files with 12 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue