public class JythonEditor extends Object implements UndoableEditListener
This class relies very heavily upon the wonderful RSyntaxTextArea project.
| Modifier and Type | Class and Description |
|---|---|
static class |
JythonEditor.McvJythonTextArea |
| Modifier and Type | Field and Description |
|---|---|
private org.fife.ui.rtextarea.RTextScrollPane |
scrollPane
Scroll pane for
textArea. |
private JythonEditor.McvJythonTextArea |
textArea
Text area that contains the syntax-highlighted text.
|
private UndoManager |
undo
Undo manager.
|
| Constructor and Description |
|---|
JythonEditor()
Creates a new JythonEditor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addUndoableEditListener(UndoableEditListener l)
Adds the given undoable edit listener to
textArea. |
void |
copy()
Copies selected text into system clipboard.
|
JPopupMenu |
createPopupMenu()
Returns the default
JPopupMenu created by
RSyntaxTextArea.createPopupMenu(). |
JPanel |
getLineNumberComponent()
Returns the component (aka "the gutter" that contains
optional information like line numbers.
|
JScrollPane |
getScrollPane()
Returns the
JScrollPane that contains textArea. |
String |
getText()
Returns a string containing the text of
textArea. |
JTextComponent |
getTextComponent()
Returns the text area responsible for syntax highlighting.
|
void |
insertText(String textToInsert)
Insert the given text at the caret.
|
boolean |
isEnabled()
Whether or not changes can be made to
textArea. |
void |
removeUndoableEditListener(UndoableEditListener l)
Remove the given undoable edit listener from
textArea. |
void |
setEnabled(boolean enabled)
Controls whether or not changes can be made to the contents of
textArea. |
void |
setText(String text)
Sets the text of this document to the given
String. |
void |
undoableEditHappened(UndoableEditEvent e)
Handles undoable edits
|
private final JythonEditor.McvJythonTextArea textArea
private final org.fife.ui.rtextarea.RTextScrollPane scrollPane
textArea.private final UndoManager undo
public JythonEditor()
public JTextComponent getTextComponent()
textArea.public JScrollPane getScrollPane()
JScrollPane that contains textArea.JScrollPane with the text area. Suitable for adding to
a JPanel.public void setText(String text)
String.text - New text to use in textArea.public String getText()
textArea.public void setEnabled(boolean enabled)
textArea.enabled - true if the editor should be enabled,
false otherwise.public JPanel getLineNumberComponent()
JPanel that contains the line numbers.public void copy()
public boolean isEnabled()
textArea.true if changes are allowed, false otherwise.public void insertText(String textToInsert)
textToInsert - Text to insert.public void undoableEditHappened(UndoableEditEvent e)
undoableEditHappened in interface UndoableEditListenere - Event that represents the undoable edit.public void addUndoableEditListener(UndoableEditListener l)
textArea.l - Listener to add.public void removeUndoableEditListener(UndoableEditListener l)
textArea.l - Listener to remove.public JPopupMenu createPopupMenu()
JPopupMenu created by
RSyntaxTextArea.createPopupMenu().