|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JTextArea
org.fife.ui.rtextarea.RTextArea
org.fife.ui.rsyntaxtextarea.RSyntaxTextArea
org.fife.ui.rsyntaxtextarea.TextEditorPane
public class TextEditorPane
An extension of RSyntaxTextArea
that adds information about the file being edited, such as:
Both local and remote files (e.g. ftp) are supported. See the
FileLocation class for more information.
FileLocation,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.fife.ui.rtextarea.RTextArea |
|---|
RTextArea.RTextAreaMutableCaretEvent |
| Nested classes/interfaces inherited from class javax.swing.JTextArea |
|---|
javax.swing.JTextArea.AccessibleJTextArea |
| Nested classes/interfaces inherited from class javax.swing.text.JTextComponent |
|---|
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
static java.lang.String |
BACKGROUND_IMAGE_PROPERTY
|
static java.lang.String |
CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY
|
static java.lang.String |
CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY
|
static java.lang.String |
DIRTY_PROPERTY
|
static java.lang.String |
FULL_PATH_PROPERTY
|
static java.lang.String |
HIGHLIGHT_CURRENT_LINE_PROPERTY
|
static long |
LAST_MODIFIED_UNKNOWN
The value returned by getLastSaveOrLoadTime() for remote files. |
static java.lang.String |
READ_ONLY_PROPERTY
|
static java.lang.String |
ROUNDED_SELECTION_PROPERTY
|
| Fields inherited from class org.fife.ui.rtextarea.RTextArea |
|---|
COPY_ACTION, CUT_ACTION, DELETE_ACTION, INSERT_MODE, MARK_ALL_COLOR_PROPERTY, OVERWRITE_MODE, PASTE_ACTION, REDO_ACTION, SELECT_ALL_ACTION, UNDO_ACTION |
| Fields inherited from class javax.swing.text.JTextComponent |
|---|
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
TextEditorPane()
Constructor. |
|
TextEditorPane(int textMode)
Constructor. |
|
TextEditorPane(int textMode,
boolean wordWrapEnabled)
Creates a new TextEditorPane. |
|
TextEditorPane(int textMode,
boolean wordWrapEnabled,
FileLocation loc)
Creates a new TextEditorPane. |
|
TextEditorPane(int textMode,
boolean wordWrapEnabled,
FileLocation loc,
java.lang.String defaultEnc)
Creates a new TextEditorPane. |
|
| Method Summary | |
|---|---|
protected void |
addCurrentLineHighlightListeners()
Adds listeners that listen for changes to the current line, so we can update our "current line highlight." This is needed only because of an apparent difference between the JRE 1.4.2 and 1.5.0 (needed on 1.4.2, not needed on 1.5.0). |
void |
changedUpdate(javax.swing.event.DocumentEvent e)
Callback for when styles in the current document change. |
void |
convertSpacesToTabs()
Converts all instances of a number of spaces equal to a tab size into a tab in this text area. |
void |
convertTabsToSpaces()
Converts all instances of a tab into a number of spaces equivalent to a tab in this text area. |
protected void |
forceCurrentLineHighlightRepaint()
Forces the current line highlight to be repainted. |
java.awt.Color |
getBackground()
Returns the java.awt.Color used as the background color for
this text area. |
java.awt.Image |
getBackgroundImage()
Returns the image currently used for the background. |
java.lang.Object |
getBackgroundObject()
Returns the Object representing the background for all
documents in this tabbed pane; either a java.awt.Color or a
java.lang.Image containing the image used as the background
for this text area. |
int |
getCaretLineNumber()
Gets the line number that the caret is on. |
int |
getCaretOffsetFromLineStart()
Gets the position from the beginning of the current line that the caret is on. |
java.awt.Color |
getCurrentLineHighlightColor()
Returns the color being used to highlight the current line. |
static java.awt.Color |
getDefaultCaretColor()
Returns the default caret color. |
static java.awt.Color |
getDefaultCurrentLineHighlightColor()
Returns the "default" color for highlighting the current line. |
static java.awt.Font |
getDefaultFont()
Returns the default font for text areas. |
static java.awt.Color |
getDefaultForeground()
Returns the default foreground color for text in this text area. |
static java.awt.Color |
getDefaultMarginLineColor()
Returns the default color for the margin line. |
static int |
getDefaultMarginLinePosition()
Returns the default margin line position. |
static int |
getDefaultTabSize()
Returns the default tab size, in spaces. |
java.lang.String |
getEncoding()
Returns the encoding to use when reading or writing this file. |
boolean |
getFadeCurrentLineHighlight()
Returns whether the current line highlight is faded. |
java.lang.String |
getFileFullPath()
Returns the full path to this document. |
java.lang.String |
getFileName()
Returns the file name of this document. |
boolean |
getHighlightCurrentLine()
Returns whether or not the current line is highlighted. |
long |
getLastSaveOrLoadTime()
Returns the timestamp for when this file was last loaded or saved by this editor pane. |
int |
getLineEndOffsetOfCurrentLine()
Returns the offset of the last character of the line that the caret is on. |
java.lang.Object |
getLineSeparator()
Returns the line separator used when writing this file (e.g. |
int |
getLineStartOffsetOfCurrentLine()
Returns the offset of the first character of the line that the caret is on. |
java.awt.Color |
getMarginLineColor()
Returns the color used to paint the margin line. |
int |
getMarginLinePixelLocation()
Returns the margin line position (in pixels) from the left-hand side of the text area. |
int |
getMarginLinePosition()
Returns the margin line position (which is the number of 'm' widths in the current font the margin line is over). |
boolean |
getRoundedSelectionEdges()
Returns whether selection edges are rounded in this text area. |
boolean |
getTabsEmulated()
Returns whether or not tabs are emulated with spaces (i.e., "soft" tabs). |
void |
insertUpdate(javax.swing.event.DocumentEvent e)
Callback for when text is inserted into the document. |
boolean |
isDirty()
Returns whether or not the text in this editor has unsaved changes. |
boolean |
isLocal()
Returns whether this file is a local file. |
boolean |
isLocalAndExists()
Returns whether this is a local file that already exists. |
boolean |
isMarginLineEnabled()
Returns whether or not the margin line is being painted. |
boolean |
isModifiedOutsideEditor()
Returns whether the text file has been modified outside of this editor since the last load or save operation. |
static boolean |
isOSX()
Returns whether the OS we're running on is OS X. |
boolean |
isReadOnly()
Returns whether or not the text area should be treated as read-only. |
void |
load(FileLocation loc,
java.lang.String defaultEnc)
Loads the specified file in this editor. |
protected void |
possiblyUpdateCurrentLineHighlightLocation()
Updates the current line highlight location. |
protected void |
processComponentEvent(java.awt.event.ComponentEvent e)
Overridden so we can tell when the text area is resized and update the current-line highlight, if necessary (i.e., if it is enabled and if lineWrap is enabled. |
void |
reload()
Reloads this file from disk. |
void |
removeUpdate(javax.swing.event.DocumentEvent e)
Called whenever text is removed from this editor. |
void |
save()
Saves the file in its current encoding. |
void |
saveAs(FileLocation loc)
Saves this file in a new local location. |
void |
setBackground(java.awt.Color bg)
Sets the background color of this text editor. |
void |
setBackgroundImage(java.awt.Image image)
Sets this image as the background image. |
void |
setBackgroundObject(java.lang.Object newBackground)
Makes the background into this Object. |
void |
setCurrentLineHighlightColor(java.awt.Color color)
Sets the color to use to highlight the current line. |
void |
setDocument(javax.swing.text.Document doc)
Sets the document for this editor. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding to use when reading or writing this file. |
void |
setFadeCurrentLineHighlight(boolean fade)
Sets whether the current line highlight should have a "fade" effect. |
void |
setHighlightCurrentLine(boolean highlight)
Sets whether or not the current line is highlighted. |
void |
setLineSeparator(java.lang.String separator)
Sets the line separator sequence to use when this file is saved (e.g. |
void |
setLineSeparator(java.lang.String separator,
boolean setDirty)
Sets the line separator sequence to use when this file is saved (e.g. |
void |
setLineWrap(boolean wrap)
Sets whether or not word wrap is enabled. |
void |
setMarginLineColor(java.awt.Color color)
Sets the color used to paint the margin line. |
void |
setMarginLineEnabled(boolean enabled)
Enables or disables the margin line. |
void |
setMarginLinePosition(int size)
Sets the number of 'm' widths the margin line is over. |
void |
setReadOnly(boolean readOnly)
Sets whether or not this text area should be treated as read-only. |
protected void |
setRTextAreaUI(RTextAreaUI ui)
Sets the UI for this RTextArea. |
void |
setTabsEmulated(boolean areEmulated)
Changes whether or not tabs should be emulated with spaces (i.e., soft tabs). |
void |
setTabSize(int size)
Workaround, since in JDK1.4 it appears that setTabSize()
doesn't work for a JTextArea unless you use the constructor
specifying the number of rows and columns... |
void |
syncLastSaveOrLoadTimeToActualFile()
Syncs this text area's "last saved or loaded" time to that of the file being edited, if that file is local and exists. |
protected void |
updateMarginLineX()
This is here so subclasses such as RSyntaxTextArea that
have multiple fonts can define exactly what it means, for example, for
the margin line to be "80 characters" over. |
int |
yForLineContaining(int offs)
Returns the y-coordinate of the line containing an offset. |
| Methods inherited from class javax.swing.JTextArea |
|---|
append, getAccessibleContext, getColumns, getColumnWidth, getLineCount, getLineEndOffset, getLineOfOffset, getLineStartOffset, getLineWrap, getPreferredScrollableViewportSize, getPreferredSize, getRowHeight, getRows, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getTabSize, getUIClassID, getWrapStyleWord, insert, paramString, setColumns, setRows, setWrapStyleWord |
| Methods inherited from class javax.swing.text.JTextComponent |
|---|
addCaretListener, addInputMethodListener, addKeymap, copy, cut, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPrintable, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, print, print, print, processInputMethodEvent, removeCaretListener, removeKeymap, select, selectAll, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setText, updateUI, viewToModel, write |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FULL_PATH_PROPERTY
public static final java.lang.String DIRTY_PROPERTY
public static final java.lang.String READ_ONLY_PROPERTY
public static final long LAST_MODIFIED_UNKNOWN
getLastSaveOrLoadTime() for remote files.
public static final java.lang.String BACKGROUND_IMAGE_PROPERTY
public static final java.lang.String CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY
public static final java.lang.String CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY
public static final java.lang.String HIGHLIGHT_CURRENT_LINE_PROPERTY
public static final java.lang.String ROUNDED_SELECTION_PROPERTY
| Constructor Detail |
|---|
public TextEditorPane()
public TextEditorPane(int textMode)
textMode - Either INSERT_MODE or
OVERWRITE_MODE.
public TextEditorPane(int textMode,
boolean wordWrapEnabled)
TextEditorPane. The file will be given
a default name.
textMode - Either INSERT_MODE or
OVERWRITE_MODE.wordWrapEnabled - Whether or not to use word wrap in this pane.
public TextEditorPane(int textMode,
boolean wordWrapEnabled,
FileLocation loc)
throws java.io.IOException
TextEditorPane.
textMode - Either INSERT_MODE or
OVERWRITE_MODE.wordWrapEnabled - Whether or not to use word wrap in this pane.loc - The location of the text file being edited. If this value
is null, a file named "Untitled.txt" in the current
directory is used.
java.io.IOException - If an IO error occurs reading the file at
loc. This of course won't happen if
loc is null.
public TextEditorPane(int textMode,
boolean wordWrapEnabled,
FileLocation loc,
java.lang.String defaultEnc)
throws java.io.IOException
TextEditorPane.
textMode - Either INSERT_MODE or
OVERWRITE_MODE.wordWrapEnabled - Whether or not to use word wrap in this pane.loc - The location of the text file being edited. If this value
is null, a file named "Untitled.txt" in the current
directory is used. This file is displayed as empty even if it
actually exists.defaultEnc - The default encoding to use when opening the file,
if the file is not Unicode. If this value is null,
a system default value is used.
java.io.IOException - If an IO error occurs reading the file at
loc. This of course won't happen if
loc is null.| Method Detail |
|---|
public void changedUpdate(javax.swing.event.DocumentEvent e)
changedUpdate in interface javax.swing.event.DocumentListenere - The document event.public java.lang.String getEncoding()
setEncoding(String)public java.lang.String getFileFullPath()
public java.lang.String getFileName()
public long getLastSaveOrLoadTime()
For remote files, this method will always return
LAST_MODIFIED_UNKNOWN.
LAST_MODIFIED_UNKNOWN if it is a remote file.isModifiedOutsideEditor()public java.lang.Object getLineSeparator()
\n", "\r\n", or "\r").
Note that this value is an Object and not a
String as that is the way the Document interface
defines its property values. If you always use
setLineSeparator(String) to modify this value, then the value
returned from this method will always be a String.
null, then
the system default line separator is used (usually the value
of System.getProperty("line.separator")).setLineSeparator(String),
setLineSeparator(String, boolean)public void insertUpdate(javax.swing.event.DocumentEvent e)
insertUpdate in interface javax.swing.event.DocumentListenere - Information on the insertion.public boolean isDirty()
public boolean isLocal()
public boolean isLocalAndExists()
public boolean isModifiedOutsideEditor()
false.This method may be used by applications to implement a reloading feature, where the user is prompted to reload a file if it has been modified since their last open or save.
getLastSaveOrLoadTime()public boolean isReadOnly()
setReadOnly(boolean)
public void load(FileLocation loc,
java.lang.String defaultEnc)
throws java.io.IOException
loc - The location of the file to load. This cannot be
null.defaultEnc - The encoding to use when loading/saving the file.
This encoding will only be used if the file is not Unicode.
If this value is null, the system default encoding
is used.
java.io.IOException - If an IO error occurs.save(),
saveAs(FileLocation)
public void reload()
throws java.io.IOException
The file's "dirty" state will be set to false after this
operation. If this is a local file, its "last modified" time is
updated to reflect that of the actual file.
Note that if the file has been modified on disk, and is now a Unicode
encoding when before it wasn't (or if it is a different Unicode now),
this will cause this TextEditorPane's encoding to change.
Otherwise, the file's encoding will stay the same.
java.io.IOException - If the file does not exist, or if an IO error
occurs reading the file.isLocalAndExists()public void removeUpdate(javax.swing.event.DocumentEvent e)
removeUpdate in interface javax.swing.event.DocumentListenere - The document event.
public void save()
throws java.io.IOException
The text area's "dirty" state is set to false, and if
this is a local file, its "last modified" time is updated.
java.io.IOException - If an IO error occurs.saveAs(FileLocation),
load(FileLocation, String)
public void saveAs(FileLocation loc)
throws java.io.IOException
FULL_PATH_PROPERTY.
loc - The location to save to.
java.io.IOException - If an IO error occurs.save(),
load(FileLocation, String)public void setDocument(javax.swing.text.Document doc)
setDocument in class RSyntaxTextAreadoc - The new document.public void setEncoding(java.lang.String encoding)
encoding - The new encoding.
java.nio.charset.UnsupportedCharsetException - If the encoding is not supported.
java.lang.NullPointerException - If encoding is
null.getEncoding()public void setLineSeparator(java.lang.String separator)
\n", "\r\n" or "\r").
Besides parameter checking, this method is preferred over
getDocument().putProperty() because it sets the editor's
dirty flag when the line separator is changed.
separator - The new line separator.
java.lang.NullPointerException - If separator is
null.
java.lang.IllegalArgumentException - If separator is not one
of "\n", "\r\n" or "\r".getLineSeparator()
public void setLineSeparator(java.lang.String separator,
boolean setDirty)
\n", "\r\n" or "\r").
Besides parameter checking, this method is preferred over
getDocument().putProperty() because can set the editor's
dirty flag when the line separator is changed.
separator - The new line separator.setDirty - Whether the dirty flag should be set if the line
separator is changed.
java.lang.NullPointerException - If separator is
null.
java.lang.IllegalArgumentException - If separator is not one
of "\n", "\r\n" or "\r".getLineSeparator()public void setReadOnly(boolean readOnly)
READ_ONLY_PROPERTY.
readOnly - Whether or not the document is read-only.isReadOnly()public void syncLastSaveOrLoadTimeToActualFile()
You normally do not have to call this method, as the "last saved or
loaded" time for TextEditorPanes is kept up-to-date internally
during such operations as save(), reload(), etc.
getLastSaveOrLoadTime(),
isModifiedOutsideEditor()protected void addCurrentLineHighlightListeners()
public void convertSpacesToTabs()
convertTabsToSpaces(),
getTabsEmulated(),
setTabsEmulated(boolean)public void convertTabsToSpaces()
convertSpacesToTabs(),
getTabsEmulated(),
setTabsEmulated(boolean)protected void forceCurrentLineHighlightRepaint()
RSyntaxTextArea.
public final java.awt.Color getBackground()
java.awt.Color used as the background color for
this text area. If a java.awt.Image image is currently
being used instead, null is returned.
getBackground in class java.awt.Componentnull if an image
is currently the background.public final java.awt.Image getBackgroundImage()
java.awt.Color and
not a java.awt.Image, then null is returned.
java.awt.Image used for the background, or
null if the background is not an image.setBackgroundImage(java.awt.Image)public final java.lang.Object getBackgroundObject()
Object representing the background for all
documents in this tabbed pane; either a java.awt.Color or a
java.lang.Image containing the image used as the background
for this text area.
Object used for the background.setBackgroundObject(Object newBackground)public final int getCaretLineNumber()
public final int getCaretOffsetFromLineStart()
public java.awt.Color getCurrentLineHighlightColor()
getHighlightCurrentLine(),
setHighlightCurrentLine(boolean),
setCurrentLineHighlightColor(java.awt.Color)public static final java.awt.Color getDefaultCaretColor()
public static final java.awt.Color getDefaultCurrentLineHighlightColor()
public static final java.awt.Font getDefaultFont()
public static final java.awt.Color getDefaultForeground()
public static final java.awt.Color getDefaultMarginLineColor()
getMarginLineColor(),
setMarginLineColor(Color)public static final int getDefaultMarginLinePosition()
getMarginLinePosition(),
setMarginLinePosition(int)public static final int getDefaultTabSize()
public boolean getFadeCurrentLineHighlight()
setFadeCurrentLineHighlight(boolean)public boolean getHighlightCurrentLine()
setHighlightCurrentLine(boolean),
getCurrentLineHighlightColor(),
setCurrentLineHighlightColor(java.awt.Color)public final int getLineEndOffsetOfCurrentLine()
public final int getLineStartOffsetOfCurrentLine()
public java.awt.Color getMarginLineColor()
setMarginLineColor(Color)public int getMarginLinePixelLocation()
getDefaultMarginLinePosition(),
setMarginLinePosition(int)public int getMarginLinePosition()
getDefaultMarginLinePosition(),
setMarginLinePosition(int)public boolean getRoundedSelectionEdges()
setRoundedSelectionEdges(boolean)public boolean getTabsEmulated()
true if tabs are emulated with spaces;
false if they aren't.setTabsEmulated(boolean)public boolean isMarginLineEnabled()
setMarginLineEnabled(boolean)public static boolean isOSX()
protected void possiblyUpdateCurrentLineHighlightLocation()
protected void processComponentEvent(java.awt.event.ComponentEvent e)
processComponentEvent in class java.awt.Componente - The component event about to be sent to all registered
ComponentListeners.public void setBackground(java.awt.Color bg)
setBackgroundObject(bg).
NOTE: the opaque property is set to true when the
background is set to a color (by this method). When an image is used
for the background, opaque is set to false. This is because
we perform better when setOpaque is true, but if we use an
image for the background when opaque is true, we get on-screen
garbage when the user scrolls via the arrow keys. Thus we
need setOpaque to be false in that case.You never have to change the opaque property yourself; it is always done for you.
setBackground in class javax.swing.JComponentbg - The color to use as the background color.public void setBackgroundImage(java.awt.Image image)
BACKGROUND_IMAGE_PROPERTY.
NOTE: the opaque property is set to true when the
background is set to a color. When an image is used for the
background (by this method), opaque is set to false. This is because
we perform better when setOpaque is true, but if we use an
image for the background when opaque is true, we get on-screen
garbage when the user scrolls via the arrow keys. Thus we
need setOpaque to be false in that case.
You never have to change the opaque property yourself; it is always done for you.
image - The image to use as this text area's background.getBackgroundImage()public void setBackgroundObject(java.lang.Object newBackground)
Object.
newBackground - The java.awt.Color or
java.awt.Image object. If newBackground
is not either of these, the background is set to plain white.public void setCurrentLineHighlightColor(java.awt.Color color)
CURRENT_LINE_HIGHLIGHT_COLOR_PROPERTY.
color - The color to use to highlight the current line.
java.lang.NullPointerException - if color is null.getHighlightCurrentLine(),
setHighlightCurrentLine(boolean),
getCurrentLineHighlightColor()public void setFadeCurrentLineHighlight(boolean fade)
CURRENT_LINE_HIGHLIGHT_FADE_PROPERTY.
fade - Whether the fade effect should be enabled.getFadeCurrentLineHighlight()public void setHighlightCurrentLine(boolean highlight)
HIGHLIGHT_CURRENT_LINE_PROPERTY.
highlight - Whether or not to highlight the current line.getHighlightCurrentLine(),
getCurrentLineHighlightColor(),
setCurrentLineHighlightColor(java.awt.Color)public void setLineWrap(boolean wrap)
setLineWrap in class javax.swing.JTextAreawrap - Whether or not word wrap should be enabled.public void setMarginLineColor(java.awt.Color color)
color - The new margin line color.getDefaultMarginLineColor(),
getMarginLineColor()public void setMarginLineEnabled(boolean enabled)
enabled - Whether or not the margin line should be enabled.isMarginLineEnabled()public void setMarginLinePosition(int size)
size - The margin size.
#see #getDefaultMarginLinePositiongetMarginLinePosition()protected void setRTextAreaUI(RTextAreaUI ui)
RTextArea. Note that, for instances
of RTextArea, setUI only updates the popup
menu; this is because RTextAreas' look and feels are
independent of the Java Look and Feel. This method is here so
subclasses can set a UI (subclass of RTextAreaUI) if they
have to.
ui - The new UI.JTextComponent.setUI(javax.swing.plaf.TextUI)public void setTabsEmulated(boolean areEmulated)
convertTabsToSpaces() and convertSpacesToTabs().
areEmulated - Whether or not tabs should be emulated with spaces.convertSpacesToTabs(),
convertTabsToSpaces(),
getTabsEmulated()public void setTabSize(int size)
setTabSize()
doesn't work for a JTextArea unless you use the constructor
specifying the number of rows and columns...Sets the number of characters to expand tabs to. This will be multiplied by the maximum advance for variable width fonts. A PropertyChange event ("tabSize") is fired when the tab size changes.
setTabSize in class javax.swing.JTextAreasize - Number of characters to expand to.protected void updateMarginLineX()
RSyntaxTextArea that
have multiple fonts can define exactly what it means, for example, for
the margin line to be "80 characters" over.
public int yForLineContaining(int offs)
throws javax.swing.text.BadLocationException
The default implementation is equivalent to:
int line = textArea.getLineOfOffset(offs); int startOffs = textArea.getLineStartOffset(line); return modelToView(startOffs).ySubclasses that can calculate this value more quickly than traditional
JTextComponent.modelToView(int) calls should override this method to do so.
This method may be used when the entire bounding box isn't needed, to
speed up rendering.
offs - The offset info the document.
-1 if
this text area doesn't yet have a positive size.
javax.swing.text.BadLocationException - If offs isn't a valid offset
into the document.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||