public class StyledTextArea
extends javafx.scene.control.Control
This is an experimental component provided as a preview we'll improve and fix problems in up coming releases
| Modifier and Type | Class and Description |
|---|---|
static interface |
StyledTextArea.CustomQuickLink |
static class |
StyledTextArea.LineLocation |
static class |
StyledTextArea.LineSeparator
Separator for lines
|
static interface |
StyledTextArea.QuickLink |
static interface |
StyledTextArea.QuickLinkable |
static interface |
StyledTextArea.SimpleQuickLink |
| Constructor and Description |
|---|
StyledTextArea()
Create a new control
|
| Modifier and Type | Method and Description |
|---|---|
javafx.beans.property.IntegerProperty |
caretOffsetProperty()
The current caret offset
|
void |
clearSelection()
Clear the current selection
|
javafx.beans.property.ObjectProperty<StyledTextContent> |
contentProperty()
The content property
|
void |
copy()
Copy the current selection into the clipboard
|
protected javafx.scene.control.Skin<?> |
createDefaultSkin() |
void |
cut()
Cut the current selection into the clipboard
|
javafx.beans.property.BooleanProperty |
editableProperty()
The editable property
Default is
true
|
javafx.beans.property.DoubleProperty |
fixedLineHeightProperty() |
javafx.beans.property.ObjectProperty<javafx.scene.text.Font> |
fontProperty() |
javafx.beans.property.DoubleProperty |
fontZoomFactorProperty() |
javafx.beans.property.SetProperty<AnnotationPresenter> |
getAnnotationPresenter() |
javafx.beans.property.SetProperty<AnnotationProvider> |
getAnnotationProvider() |
int |
getCaretOffset() |
int |
getCharCount() |
static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> |
getClassCssMetaData() |
StyledTextContent |
getContent()
Access the content
|
java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> |
getControlCssMetaData() |
boolean |
getEditable()
Check if editable
Default is
true
|
double |
getFixedLineHeight() |
javafx.scene.text.Font |
getFont() |
double |
getFontZoomFactor() |
int |
getLineAtOffset(int caretOffset)
Get the line index for the caret
|
int |
getLineCount() |
double |
getLineHeight(int offset)
Get the line height
|
StyledTextArea.LineSeparator |
getLineSeparator() |
javafx.geometry.Point2D |
getLocationAtOffset(int offset,
StyledTextArea.LineLocation locationHint)
Check the location at the given offset
|
int |
getOffsetAtLine(int lineNumber)
Get the initial offset of the line
|
int |
getOffsetAtPosition(double x,
double y)
Get the char offset at the give coordinates
|
TriggerActionMapping |
getOverrideActionMapping() |
java.util.function.Function<java.lang.Integer,java.util.Optional<StyledTextArea.QuickLinkable>> |
getQuickLinkCallback()
returns the quick link callback.
|
TextSelection |
getSelection() |
StyleRange |
getStyleRangeAtOffset(int offset)
The style range at the given offset
|
StyleRange[] |
getStyleRanges(int start,
int length,
boolean includeRanges)
Access style ranges in the specified segment
|
int |
getTabAdvance() |
java.lang.String |
getText(int start,
int end)
Get the text for the given range
|
java.lang.String |
getUserAgentStylesheet() |
void |
impl_setCaretOffset(int offset,
boolean selection)
Deprecated.
internal API for now
|
void |
insert(java.lang.CharSequence text)
inserts text at the caret location or replaces a given selection
|
javafx.beans.property.BooleanProperty |
insertSpacesForTabProperty()
When inserting a tab it is replaced with the number of spaces defined in
tabAvanceProperty()
Already existing tabs in the content are not replaced
|
boolean |
isInsertSpacesForTab()
When inserting a tab it is replaced with the number of spaces defined in
tabAvanceProperty()
Already existing tabs in the content are not replaced
|
boolean |
isLineRulerVisible()
Is line ruler shown
Default is
false
|
boolean |
isSelectionEmpty() |
javafx.beans.property.ReadOnlyIntegerProperty |
lineCountProperty() |
javafx.beans.property.BooleanProperty |
lineRulerVisibleProperty()
Show a line ruler on the left
Default is
false
|
void |
navigateToLine(int lineIndex)
navigates to specified line
|
javafx.beans.property.ObjectProperty<TriggerActionMapping> |
overrideActionMappingProperty() |
void |
paste()
Paste the clipboard content
|
void |
replaceStyleRanges(int start,
int length,
StyleRange[] ranges)
Replace style ranges
|
void |
revealCaret()
Reveal the current caret location
|
javafx.beans.property.ObjectProperty<TextSelection> |
selectionProperty() |
void |
setCaretOffset(int offset)
Set the current caret offset
|
void |
setContent(StyledTextContent content)
Set the content
|
void |
setEditable(boolean editable)
Mark the editor editable
Default is
true
|
void |
setFixedLineHeight(double fixedLineHeight)
Set the fixed line height
|
void |
setFont(javafx.scene.text.Font value)
Set the default font used by the widget
|
void |
setFontZoomFactor(double factor) |
void |
setInsertSpacesForTab(boolean insertSpacesForTab)
When inserting a tab it is replaced with the number of spaces defined in
tabAvanceProperty()
Already existing tabs in the content are not replaced
|
void |
setLineRulerVisible(boolean lineRulerVisible)
Show/hide the line ruler
Default is
false
|
void |
setOverrideActionMapping(TriggerActionMapping mapping) |
void |
setQuickLinkCallback(java.util.function.Function<java.lang.Integer,java.util.Optional<StyledTextArea.QuickLinkable>> callback)
sets the quick link callback.
|
void |
setSelection(TextSelection selection)
Set the current selection
|
void |
setSelectionRange(int offset,
int length)
Set the selection
|
void |
setStyleRange(StyleRange range)
Set the style range
|
void |
setStyleRanges(int[] ranges,
StyleRange[] styles)
Set the style ranges
|
void |
setStyleRanges(int start,
int length,
int[] ranges,
StyleRange[] styles)
Set the style range
|
void |
setStyleRanges(StyleRange... ranges)
Set the style ranges
|
void |
setTabAdvance(int advance)
Set the number of chars a tab advances in the document.
|
javafx.beans.property.IntegerProperty |
tabAvanceProperty() |
void |
triggerAction(TextEditAction action)
Trigger the respective action
|
computeMaxHeight, computeMaxWidth, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, contextMenuProperty, executeAccessibleAction, getBaselineOffset, getContextMenu, getCssMetaData, getSkin, getTooltip, impl_cssGetFocusTraversableInitialValue, impl_processCSS, isResizable, layoutChildren, queryAccessibleAttribute, setContextMenu, setSkin, setTooltip, skinClassNameProperty, skinProperty, tooltipPropertybackgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, impl_computeContains, impl_computeGeomBounds, impl_computeLayoutBounds, impl_createPeer, impl_notifyLayoutBoundsChanged, impl_pickNodeLocal, impl_updatePeer, insetsProperty, isCacheShape, isCenterShape, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapSize, snapSpace, snapToPixelProperty, widthPropertygetChildren, getChildrenUnmodifiable, getImpl_traversalEngine, getManagedChildren, getStylesheets, impl_getAllParentStylesheets, impl_processMXNode, impl_traversalEngineProperty, isNeedsLayout, layout, lookup, needsLayoutProperty, requestLayout, requestParentLayout, setImpl_traversalEngine, setNeedsLayout, updateBoundsaccessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, containsBounds, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, fireEvent, focusedProperty, focusTraversableProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getContentBias, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, hasProperties, hoverProperty, idProperty, impl_clearDirty, impl_computeIntersects, impl_cssGetCursorInitialValue, impl_findStyles, impl_geomChanged, impl_getLeafTransform, impl_getMatchingStyles, impl_getPeer, impl_getPivotX, impl_getPivotY, impl_getPivotZ, impl_getStyleMap, impl_hasTransforms, impl_intersects, impl_intersectsBounds, impl_isDirty, impl_isDirtyEmpty, impl_isShowMnemonics, impl_isTreeVisible, impl_layoutBoundsChanged, impl_markDirty, impl_pickNode, impl_processCSS, impl_reapplyCSS, impl_setShowMnemonics, impl_setStyleMap, impl_showMnemonicsProperty, impl_syncPeer, impl_transformsChanged, impl_traverse, impl_treeVisibleProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, visiblePropertypublic javafx.beans.property.DoubleProperty fontZoomFactorProperty()
public void setFontZoomFactor(double factor)
public double getFontZoomFactor()
public void setOverrideActionMapping(TriggerActionMapping mapping)
public TriggerActionMapping getOverrideActionMapping()
public javafx.beans.property.ObjectProperty<TriggerActionMapping> overrideActionMappingProperty()
public javafx.beans.property.SetProperty<AnnotationPresenter> getAnnotationPresenter()
public javafx.beans.property.SetProperty<AnnotationProvider> getAnnotationProvider()
public void setQuickLinkCallback(java.util.function.Function<java.lang.Integer,java.util.Optional<StyledTextArea.QuickLinkable>> callback)
If the callback returns one ore more entries, quick linking is available for the cursor position
callback - the quick linking callbackpublic java.util.function.Function<java.lang.Integer,java.util.Optional<StyledTextArea.QuickLinkable>> getQuickLinkCallback()
public double getFixedLineHeight()
public void setFixedLineHeight(double fixedLineHeight)
fixedLineHeight - the fixed line heightpublic javafx.beans.property.DoubleProperty fixedLineHeightProperty()
public final javafx.beans.property.ObjectProperty<javafx.scene.text.Font> fontProperty()
public final void setFont(javafx.scene.text.Font value)
value - the valuepublic final javafx.scene.text.Font getFont()
public StyledTextArea.LineSeparator getLineSeparator()
public java.lang.String getUserAgentStylesheet()
getUserAgentStylesheet in class javafx.scene.layout.Regionprotected javafx.scene.control.Skin<?> createDefaultSkin()
createDefaultSkin in class javafx.scene.control.Controlpublic javafx.beans.property.BooleanProperty lineRulerVisibleProperty()
Default is false
public void setLineRulerVisible(boolean lineRulerVisible)
Default is false
lineRulerVisible - the new statepublic boolean isLineRulerVisible()
Default is false
public javafx.beans.property.IntegerProperty caretOffsetProperty()
public void setCaretOffset(int offset)
offset - the new offset@Deprecated
public void impl_setCaretOffset(int offset,
boolean selection)
offset - the offsetselection - true to update the current selectionpublic int getCaretOffset()
public void setContent(StyledTextContent content)
content - the contentpublic StyledTextContent getContent()
public javafx.beans.property.ObjectProperty<StyledTextContent> contentProperty()
public void setStyleRange(StyleRange range)
range - the rangepublic void setStyleRanges(int start,
int length,
int[] ranges,
StyleRange[] styles)
start - the startlength - the lengthranges - the rangesstyles - the style rangespublic void setStyleRanges(int[] ranges,
StyleRange[] styles)
ranges - the rangesstyles - the style rangespublic void setStyleRanges(StyleRange... ranges)
ranges - the rangespublic void replaceStyleRanges(int start,
int length,
StyleRange[] ranges)
start - the startlength - the lengthranges - the new rangespublic StyleRange[] getStyleRanges(int start, int length, boolean includeRanges)
start - the startlength - the lengthincludeRanges - include rangespublic StyleRange getStyleRangeAtOffset(int offset)
offset - the offsetpublic int getCharCount()
public TextSelection getSelection()
public javafx.beans.property.ObjectProperty<TextSelection> selectionProperty()
public void setSelection(TextSelection selection)
selection - the selectionpublic void clearSelection()
public void setSelectionRange(int offset,
int length)
offset - the offsetlength - the lengthpublic void setEditable(boolean editable)
Default is true
editable - the new valuepublic boolean getEditable()
Default is true
public javafx.beans.property.BooleanProperty editableProperty()
Default is true
public javafx.geometry.Point2D getLocationAtOffset(int offset,
StyledTextArea.LineLocation locationHint)
offset - the offsetlocationHint - hint for y coordinate relative to linepublic double getLineHeight(int offset)
offset - the offsetpublic int getLineAtOffset(int caretOffset)
caretOffset - the caret offsetpublic int getOffsetAtLine(int lineNumber)
lineNumber - the line numberpublic java.lang.String getText(int start,
int end)
start - the startend - the endpublic boolean isSelectionEmpty()
true if the selection has a length of 0public void insert(java.lang.CharSequence text)
text - public javafx.beans.property.ReadOnlyIntegerProperty lineCountProperty()
public int getLineCount()
public void paste()
public void copy()
public void cut()
public int getOffsetAtPosition(double x,
double y)
x - the xy - the ypublic static java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> getClassCssMetaData()
public java.util.List<javafx.css.CssMetaData<? extends javafx.css.Styleable,?>> getControlCssMetaData()
getControlCssMetaData in class javafx.scene.control.Controlpublic void navigateToLine(int lineIndex)
lineIndex - public void setTabAdvance(int advance)
advance - the number of charspublic int getTabAdvance()
public javafx.beans.property.IntegerProperty tabAvanceProperty()
public void setInsertSpacesForTab(boolean insertSpacesForTab)
tabAvanceProperty()
Already existing tabs in the content are not replaced
insertSpacesForTab - true to turn on the replacementpublic boolean isInsertSpacesForTab()
tabAvanceProperty()
Already existing tabs in the content are not replaced
true if replacement is turned onpublic javafx.beans.property.BooleanProperty insertSpacesForTabProperty()
tabAvanceProperty()
Already existing tabs in the content are not replaced
public void revealCaret()
public void triggerAction(TextEditAction action)
action - the action