Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public class DocumentView
- Object
- Component
- ScrollSurface
- DocumentView
ImplementsAnimation, Editable, StyleListener, TextInputClient, TextInputClient.CompositionCancellation, TextInputGeometry.Provider
Shows a document as pages and edits it, the way DataGrid shows and edits a Sheet.
DocumentModel model = new DocumentModel(new Document());
model.insertBlock(0, new Paragraph(model.newId('p'), RichText.of("Quarterly review")));
DocumentView view = new DocumentView(model);
Form form = new Form("Document", new BorderLayout());
form.add(BorderLayout.CENTER, view);
form.show();The view subscribes to its model while it is on a form and lays the document out again on
every change, so anything that edits the model – the view itself, a toolbar, an undo button
– is shown at once. Pages are laid out by DocumentLayout with the view’s Measurer
(ScreenMeasurer by default, the fonts the view draws in). Set a PdfMeasurer to break
pages exactly where the PDF export does, at the cost of spacing set by the PDF’s fonts.
A tap places the caret, a drag or a double tap selects, and typing, Backspace, Delete and Enter edit through the model, which gives undo for free. Pinch or Control and the wheel zooms; by default a page is fitted to the view’s width when it would not fit.
Constructors
public DocumentView() | A view of an empty document. |
public DocumentView(Document doc) | A view of a document, in a model of its own. |
public DocumentView(DocumentModel model) | A view of a model. |
Methods
public DocumentModel getModel() | The model shown. |
public final void setModel(DocumentModel value) | Shows another model. |
public Document getDocument() | The document shown; a shortcut for getModel().getDocument(). |
public void setDocument(Document doc) | Replaces the document, forgetting the undo history; a shortcut for getModel().reset(doc). |
public void setMeasurer(Measurer value) | Sets the measurer pages are laid out with, for instance a PdfMeasurer with TrueType fonts registered for a script the standard fonts lack. |
public Measurer getMeasurer() | The measurer pages are laid out with. |
public DocumentLayout getLayout() | The current layout. |
public boolean isEditable() | Whether the user may edit the document. |
public void setEditable(boolean value) | Lets the user edit the document, or only read and select it. |
public float getZoom() | The zoom factor on top of the fitted or natural size. |
public void setZoom(float value) | Sets the zoom factor on top of the fitted or natural size. |
public boolean isFitWidth() | Whether a page wider than the view is shrunk to fit its width. |
public void setFitWidth(boolean value) | Shrinks pages wider than the view to its width, or shows them at their natural size. |
public TextPosition getCaret() | The caret, or null when there is none. |
public void setCaret(TextPosition value) | Places the caret and clears the selection. |
public void setSelection(TextPosition from, TextPosition to) | Selects the text between two positions; equal positions place the caret. |
public TextPosition[] getSelection() | The selection, earlier end first, or null when nothing is selected. |
public void addCaretListener(ActionListener l) | Adds a listener told when the caret or the selection moves, for a toolbar showing the style at the caret. |
public void removeCaretListener(ActionListener l) | Removes a caret listener. |
protected void initComponent() | Allows subclasses to bind functionality that relies on fully initialized and “ready for action” component state |
protected void deinitialize() | Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. |
public float getScale() | Pixels per point at the current size. |
protected void scrollChanged() | The scroll position changed. |
public int[] itemBounds(int page, LayoutItem item) | Where a laid out item is, in the view’s own coordinates at the current scroll. |
protected void layoutSurface(int width, int height) | Lays the surface out for a size: sets the header sizes and whatever the content’s size depends on. |
protected int getContentWidth() | The width of what scrolls, in pixels, without the left header. |
protected int getContentHeight() | The height of what scrolls, in pixels, without the top header. |
protected boolean zoomBy(float factor, int x, int y) | Zooms by factor around a point, for a pinch or Control/Command and the wheel. |
public void setProofreader(Proofreader p) | Underlines spelling and grammar problems with a wavy line, red for spelling and blue for grammar. |
public Proofreader getProofreader() | The proofreader underlining problems. |
public ProofIssue proofIssueAt(TextPosition at, int max) | The problem under a text position, with spelling suggestions, for a menu of fixes. |
public void applySuggestion(String paragraphId, ProofIssue issue, String replacement) | Replaces the range of a problem with one of its suggestions, as one undoable edit. |
protected void paintContent(Graphics g, int x, int y) | Paints what scrolls. |
protected void paintComponentBox(Graphics g, LayoutItem item, int x, int y, int w, int h) | Paints an embedded component’s box: its snapshot, or a frame naming its type. |
public List<Comment> getCommentsAtCaret() | The review comments over the caret. |
public Comment commentSelection(String text) | Adds a review comment over the selection, by the model’s author. |
protected Font font(TextStyle style, int px) | The platform font text of a style is drawn in, at a pixel size. |
public TextPosition positionAt(int x, int y) | The text position under a point in the view. |
protected void tapped(int x, int y, boolean doubleTap) | A tap that was not a drag or a long press. |
protected boolean editStarted(int x, int y, ScrollSurface.EditTrigger trigger) | Asked when a drag or a long press begins, at the point where the pointer went down, in the component’s coordinates. |
protected void editMoved(int x, int y) | The pointer of an edit moved, or the surface scrolled under it. |
protected void editEnded(boolean committed) | The edit is over. |
protected boolean animateSurface() | Advances the view’s own motion. |
protected void focusGained() | Callback allowing a developer to track when the component gains focus |
protected void focusLost() | Callback allowing a developer to track wheh the component loses focus |
public void paint(Graphics g) | Paints the view, then the touch selection handles and toolbar over it. |
public void copySelection() | Copies the selection to the clipboard as plain text, HTML, RTF and Markdown, so it pastes with its formatting into a word processor, a browser or a text editor alike. |
public void cutSelection() | Copies the selection to the clipboard and deletes it. |
public void pasteClipboard() | Pastes the clipboard over the selection, keeping formatting when the clipboard holds HTML, RTF or Markdown. |
public void selectAll() | Selects the whole document. |
public void typeText(String text) | Types text at the caret, replacing the selection. |
public void deleteBackward() | Deletes the selection, or the character before the caret, joining paragraphs at a paragraph start. |
public void deleteForward() | Deletes the selection, or the character after the caret. |
public void moveCaret(boolean forward, boolean extend) | Moves the caret one character, or extends the selection when extend is true. |
public void moveCaretLine(boolean down, boolean extend) | Moves the caret a line up or down, or extends the selection. |
public void keyPressed(int keyCode) | If this Component is focused, the key pressed event will call this method |
public void commitText(String text) | Typed text from the platform’s keyboard or input method. |
public void setComposingText(String text, int relativeCaret) | Composition is committed whole: the composing text is typed as it is. |
public void finishComposing() | Nothing to do: composing text is never shown before it is committed. |
public void deleteSurroundingText(int before, int after) | Deletes around the caret, within its paragraph. |
public void onKeyCommand(int command, int modifiers) | A key command from the platform. |
public void onEditorAction(int action) | The Enter action splits the paragraph. |
public TextInputState getEditingState() | The caret’s paragraph, as the platform sees the text being edited. |
public int[] getCaretRect() | The caret rectangle in screen coordinates. |
public TextInputConfig getConfig() | Multi-line text with autocorrect. |
public void inputFocusGained() | Nothing to do. |
public void inputFocusLost() | The platform let go of input. |
public void cancelComposing() | Nothing to undo: composing text is never inserted before it is committed. |
public TextInputGeometry getGeometrySnapshot() | The caret and selection rectangles the platform places its candidate window by. |
public int getTextLength() | The length of the caret’s paragraph. |
public String getTextRange(int start, int end) | Part of the caret’s paragraph. |
public int[] rectForOffset(int offset) | Where an offset of the caret’s paragraph is on screen. |
public int offsetAtPoint(int x, int y) | The offset in the caret’s paragraph nearest a screen point. |
public int[] selectionRects(int start, int end) | The selection rectangles of a range of the caret’s paragraph. |
public void replaceRange(int start, int end, String text) | Replaces part of the caret’s paragraph. |
public void setSelectionRange(int start, int end) | Selects part of the caret’s paragraph. |
Inherited nested types
Inherited fields
From Component
DEFAULT_CURSOR, CROSSHAIR_CURSOR, TEXT_CURSOR, WAIT_CURSOR, SW_RESIZE_CURSOR, SE_RESIZE_CURSOR, NW_RESIZE_CURSOR, NE_RESIZE_CURSOR, N_RESIZE_CURSOR, S_RESIZE_CURSOR, W_RESIZE_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, DRAG_REGION_NOT_DRAGGABLE, DRAG_REGION_POSSIBLE_DRAG_X, DRAG_REGION_POSSIBLE_DRAG_Y, DRAG_REGION_POSSIBLE_DRAG_XY, DRAG_REGION_LIKELY_DRAG_X, DRAG_REGION_LIKELY_DRAG_Y, DRAG_REGION_LIKELY_DRAG_XY, DRAG_REGION_IMMEDIATELY_DRAG_X, DRAG_REGION_IMMEDIATELY_DRAG_Y, DRAG_REGION_IMMEDIATELY_DRAG_XY, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET, BRB_OTHER, CENTER, TOP, LEFT, BOTTOM, RIGHT, BASELINE
From TextInputClient
KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN, KEY_HOME, KEY_END, KEY_PAGE_UP, KEY_PAGE_DOWN, KEY_BACKSPACE, KEY_DELETE, KEY_ESCAPE, KEY_COPY, KEY_CUT, KEY_PASTE, KEY_SELECT_ALL, KEY_UNDO, KEY_REDO, KEY_TAB, KEY_SCROLL_PAGE_UP, KEY_SCROLL_PAGE_DOWN, KEY_WORD_LEFT, KEY_WORD_RIGHT, MOD_SHIFT, MOD_CTRL, MOD_ALT
Inherited methods
From ScrollSurface
paintTopHeader, paintLeftHeader, paintCorner, paintOverlay, isMirrored, getBodyX, getHeaderX, getContentOriginX, setHeaderSize, getHeaderWidth, getHeaderHeight, pressStarted, isEditAutoScroll, longPressed, setDragEdits, isDragEdits, cancelEdit, isEditInProgress, isBounded, setBounded, getBodyWidth, getBodyHeight, getMaxOffsetX, getMaxOffsetY, getOffsetX, getOffsetY, scrollTo, setOffsets, refreshLayout, stopFling, currentTime, setAnimationTime, hoverAt, hoverGone, setHoverTarget, setHoverTooltip, getFadingHoverTarget, getHoverTarget, hasHoverFeedback, getHoverLevel, getLiftLevel, startSettle, applySettle, pointerHover, setHovered, requestAnimation, animate, getPageGrid, paintPage, isPrinting, saveZoomState, restoreZoomState, getPageStep, calcPreferredSize, pointerPressed, pointerDragged, longPointerPress, pointerReleased, mouseWheel, pinch, pinchReleased, shouldBlockSideSwipe
From Component
setSameSize, isSetCursorSupported, parsePreferredSize, getDefaultDragTransparency, setDefaultDragTransparency, getEditingDelegate, setEditingDelegate, getCursor, setCursor, showNativeOverlay, hideNativeOverlay, updateNativeOverlay, getNativeOverlay, getAllStyles, getSameWidth, setSameWidth, getSameHeight, setSameHeight, initLaf, getUIManager, getX, setX, getOuterX, getInnerX, getY, setY, getOuterY, getInnerY, isVisible, setVisible, getClientProperty, stripMarginAndPadding, clearClientProperties, putClientProperty, getDirtyRegion, setDirtyRegion, isOpaque, setOpaque, getWidth, setWidth, getOuterWidth, getInnerWidth, getHeight, setHeight, getOuterHeight, getInnerHeight, isDragRegion, getDragRegionStatus, getBaseline, getBaselineResizeBehavior, getPreferredSizeStr, setPreferredSizeStr, getPreferredSize, setPreferredSize, getScrollDimension, calcScrollSize, setScrollSize, getPreferredW, setPreferredW, getPreferredH, setPreferredH, getOuterPreferredH, getInnerPreferredH, getOuterPreferredW, getInnerPreferredW, setSize, getUIID, setUIID, setUIIDFinal, setUIID, getInlineAllStyles, setInlineAllStyles, getInlineSelectedStyles, setInlineSelectedStyles, getInlineUnselectedStyles, setInlineUnselectedStyles, getInlineDisabledStyles, setInlineDisabledStyles, getInlinePressedStyles, setInlinePressedStyles, remove, getParent, getOwner, setOwner, isOwnedBy, containsOrOwns, addFocusListener, removeFocusListener, addScrollListener, removeScrollListener, fireClicked, isSelectableInteraction, getSelectCommandText, setSelectCommandText, getLabelForComponent, setLabelForComponent, paintBackgrounds, paintShadows, getAbsoluteX, getAbsoluteY, isInClippingRegion, paintIntersectingComponentsAbove, paintScrollbars, paintScrollbarX, getScrollOpacity, getSelectedRect, paintScrollbarY, paintComponent, paintComponent, getBorder, getScrollable, paintBackground, isScrollable, isScrollableX, isScrollableY, getScrollX, setScrollX, getScrollY, setScrollY, onScrollX, onScrollY, getDraggedx, getDraggedy, getBottomGap, getSideGap, contains, visibleBoundsContains, hasFixedPreferredSize, getBounds, getBounds, getVisibleBounds, getVisibleBounds, isFocusable, setFocusable, onSetFocusable, resetFocusable, getTabIndex, setTabIndex, getPreferredTabIndex, setPreferredTabIndex, isTraversable, setTraversable, setShouldCalcPreferredSize, handlesInput, setHandlesInput, consumesRawTextInput, hasFocus, setFocus, getComponentForm, getTopLevelContainer, repaint, repaint, longKeyPress, keyReleased, keyRepeated, registerForAnimation, deregisterFromAnimation, getAnimationManager, getScrollAnimationSpeed, setScrollAnimationSpeed, isBlockLead, setBlockLead, isIgnorePointerEvents, setIgnorePointerEvents, isRippleEffect, setRippleEffect, getInlineStylesTheme, setInlineStylesTheme, shouldRenderComponentSelection, isHideInLandscape, setHideInLandscape, createStyleAnimation, isSmoothScrolling, setSmoothScrolling, stopScrollMomentum, pointerHoverReleased, pointerHoverPressed, pinch, rotation, isPinchBlocksDragAndDrop, setPinchBlocksDragAndDrop, pointerDragged, getDragImage, getDragTransparency, setDragTransparency, toImage, dragInitiated, drawDraggedImage, draggingOver, dragEnter, dragExit, drop, addPullToRefresh, setPullToRefresh, respondsToPointerEvents, isStickyDrag, pointerPressed, isDragAndDropOperation, pointerReleased, setVerticalScrollBounds, setHorizontalScrollBounds, isVScrollThumbGrabbed, isHScrollThumbGrabbed, isVScrollThumbHover, isHScrollThumbHover, isTensileDragEnabled, setTensileDragEnabled, getTextSelectionSupport, addDropListener, removeDropListener, addDragOverListener, removeDragOverListener, isNativeDragSource, setNativeDragSource, getNativeDragOperation, setNativeDragOperation, createNativeDragOperation, isNativeDropTarget, setNativeDropTarget, getAcceptedDropMimeTypes, setAcceptedDropMimeTypes, getAcceptedDropActions, setAcceptedDropActions, canAcceptNativeDrop, nativeDragEnter, nativeDragOver, nativeDragExit, nativeDrop, addNativeDropListener, removeNativeDropListener, addNativeDragOverListener, removeNativeDragOverListener, dragFinished, addDragFinishedListener, addStateChangeListener, removeStateChangeListener, addPointerPressedListener, addLongPressListener, addContextMenuListener, removeContextMenuListener, addMouseWheelListener, removeMouseWheelListener, addStylusListener, removeStylusListener, getContextMenuCommands, setContextMenuCommands, paintRippleOverlay, removePointerPressedListener, removeLongPressListener, removeDragFinishedListener, addPointerReleasedListener, removePointerReleasedListener, addPointerDraggedListener, removePointerDraggedListener, getDragSpeed, getStyle, getPressedStyle, getHoverStyle, setHoverStyle, isHovered, setPressedStyle, initUnselectedStyle, initPressedStyle, initDisabledStyle, initSelectedStyle, getUnselectedStyle, setUnselectedStyle, getSelectedStyle, setSelectedStyle, getDisabledStyle, setDisabledStyle, installDefaultPainter, requestFocus, toString, paramString, refreshTheme, refreshTheme, refreshTheme, isDragActivated, getGridPosY, getGridPosX, scrollRectToVisible, scrollRectToVisible, paintBorder, paintBorderBackground, isCellRenderer, setCellRenderer, isScrollVisible, setScrollVisible, setIsScrollVisible, startEditingAsync, stopEditing, isEditing, laidOut, isInitialized, setInitialized, styleChanged, getNextFocusDown, setNextFocusDown, getNextFocusUp, setNextFocusUp, getNextFocusLeft, setNextFocusLeft, getNextFocusRight, setNextFocusRight, isEnabled, setEnabled, getName, setName, initCustomStyle, deinitializeCustomStyle, isRTL, setRTL, isTactileTouch, isTactileTouch, setTactileTouch, getPropertyNames, getPropertyTypes, getPropertyTypeNames, getPropertyValue, setPropertyValue, paintLockRelease, paintLock, isSnapToGrid, setSnapToGrid, shouldBlockSideSwipeLeft, shouldBlockSideSwipeRight, blocksSideSwipe, isFlatten, setFlatten, getTensileLength, setTensileLength, isGrabsPointerEvents, setGrabsPointerEvents, getScrollOpacityChangeSpeed, setScrollOpacityChangeSpeed, growShrink, isAlwaysTensile, setAlwaysTensile, isDraggable, setDraggable, isDropTarget, setDropTarget, isChildOf, isHideInPortrait, setHideInPortrait, cancelRepaints, getBindablePropertyNames, getBindablePropertyTypes, bindProperty, unbindProperty, getBoundPropertyValue, setBoundPropertyValue, getCloudBoundProperty, setCloudBoundProperty, getCloudDestinationProperty, setCloudDestinationProperty, getComponentState, setComponentState, setHidden, isHidden, setHidden, isHidden, announceForAccessibility, getAccessibilityText, setAccessibilityText, getSemantics, getAccessibilityNode, accessibilityChanged, accessibilityChanged, getTooltip, setTooltip
Constructor details
DocumentView
public DocumentView()DocumentView
public DocumentView(Document doc)Parameters
docDocument- the document
DocumentView
public DocumentView(DocumentModel model)Parameters
modelDocumentModel- the model
Method details
getModel
public DocumentModel getModel()Returns
setModel
public final void setModel(DocumentModel value)Parameters
valueDocumentModel- the model
getDocument
public Document getDocument()getModel().getDocument().Returns
setDocument
public void setDocument(Document doc)getModel().reset(doc).Parameters
docDocument- the document
setMeasurer
public void setMeasurer(Measurer value)PdfMeasurer with TrueType
fonts registered for a script the standard fonts lack.Parameters
valueMeasurer- the measurer
getMeasurer
public Measurer getMeasurer()Returns
getLayout
public DocumentLayout getLayout()Returns
isEditable
public boolean isEditable()Returns
setEditable
public void setEditable(boolean value)Parameters
valueboolean- true to allow editing
getZoom
public float getZoom()Returns
setZoom
public void setZoom(float value)Parameters
valuefloat- between 0.25 and 6
isFitWidth
public boolean isFitWidth()Returns
setFitWidth
public void setFitWidth(boolean value)Parameters
valueboolean- true to fit
getCaret
public TextPosition getCaret()Returns
setCaret
public void setCaret(TextPosition value)Parameters
valueTextPosition- the position, or null to remove the caret
setSelection
public void setSelection(TextPosition from, TextPosition to)Parameters
fromTextPosition- where the selection is anchored
toTextPosition- where the caret is
getSelection
public TextPosition[] getSelection()Returns
addCaretListener
public void addCaretListener(ActionListener l)Parameters
lActionListener- the listener
removeCaretListener
public void removeCaretListener(ActionListener l)Parameters
lActionListener- the listener
initComponent
protected void initComponent()deinitialize
protected void deinitialize()getScale
public float getScale()Returns
scrollChanged
protected void scrollChanged()itemBounds
public int[] itemBounds(int page, LayoutItem item)Parameters
pageint- the item’s page
itemLayoutItem- the item
Returns
{x, y, width, height} in pixelslayoutSurface
protected void layoutSurface(int width, int height)getContentWidth
protected int getContentWidth()getContentHeight
protected int getContentHeight()zoomBy
protected boolean zoomBy(float factor, int x, int y)factor around a point, for a pinch or Control/Command and
the wheel.Returns
setProofreader
public void setProofreader(Proofreader p)Parameters
pProofreader- the proofreader, or null to stop
getProofreader
public Proofreader getProofreader()Returns
proofIssueAt
public ProofIssue proofIssueAt(TextPosition at, int max)Parameters
atTextPosition- the position
maxint- the most suggestions
Returns
applySuggestion
public void applySuggestion(String paragraphId, ProofIssue issue, String replacement)Parameters
paragraphIdString- the paragraph the issue was found in
issueProofIssue- the issue
replacementString- the text to put in its place
paintContent
protected void paintContent(Graphics g, int x, int y)x and y are where the content’s own origin is
on screen, which is off screen once it has scrolled. The graphics is
clipped to the content region.paintComponentBox
protected void paintComponentBox(Graphics g, LayoutItem item, int x, int y, int w, int h)Parameters
gGraphics- the graphics
itemLayoutItem- the laid out component
xint- the box’s left edge in pixels
yint- its top edge
wint- its width
hint- its height
getCommentsAtCaret
public List<Comment> getCommentsAtCaret()Returns
commentSelection
public Comment commentSelection(String text)Parameters
textString- the comment
Returns
font
protected Font font(TextStyle style, int px)Parameters
styleTextStyle- the style
pxint- the size in pixels
Returns
positionAt
public TextPosition positionAt(int x, int y)Parameters
xint- in the component’s coordinates
yint- in the component’s coordinates
Returns
tapped
protected void tapped(int x, int y, boolean doubleTap)editStarted
protected boolean editStarted(int x, int y, ScrollSurface.EditTrigger trigger)Parameters
xint- Not documented.
yint- Not documented.
triggerScrollSurface.EditTrigger- what kind of gesture it is
Returns
editMoved
protected void editMoved(int x, int y)editEnded
protected void editEnded(boolean committed)committed is false when it was cancelled: by
cancelEdit, a second finger, or the surface leaving the form.animateSurface
protected boolean animateSurface()requestAnimation to start the frames.Returns
focusGained
protected void focusGained()focusLost
protected void focusLost()paint
public void paint(Graphics g)Parameters
gGraphics- the graphics
copySelection
public void copySelection()cutSelection
public void cutSelection()pasteClipboard
public void pasteClipboard()selectAll
public void selectAll()typeText
public void typeText(String text)Parameters
textString- the text; a line break splits the paragraph
deleteBackward
public void deleteBackward()deleteForward
public void deleteForward()moveCaret
public void moveCaret(boolean forward, boolean extend)extend is true.Parameters
forwardboolean- true to move right
extendboolean- true to keep the selection anchor
moveCaretLine
public void moveCaretLine(boolean down, boolean extend)Parameters
downboolean- true to move down
extendboolean- true to keep the selection anchor
keyPressed
public void keyPressed(int keyCode)Parameters
keyCodeint- the key code value to indicate a physical key.
commitText
public void commitText(String text)Parameters
textString- the text
setComposingText
public void setComposingText(String text, int relativeCaret)Parameters
textString- the composing text
relativeCaretint- ignored
finishComposing
public void finishComposing()deleteSurroundingText
public void deleteSurroundingText(int before, int after)Parameters
beforeint- characters before the caret
afterint- characters after it
onKeyCommand
public void onKeyCommand(int command, int modifiers)Parameters
commandint- one of the
TextInputClientcommands modifiersint- modifier bits
onEditorAction
public void onEditorAction(int action)Parameters
actionint- the action
getEditingState
public TextInputState getEditingState()Returns
getCaretRect
public int[] getCaretRect()Returns
{x, y, width, height}getConfig
public TextInputConfig getConfig()Returns
inputFocusGained
public void inputFocusGained()inputFocusLost
public void inputFocusLost()cancelComposing
public void cancelComposing()getGeometrySnapshot
public TextInputGeometry getGeometrySnapshot()Returns
getTextLength
public int getTextLength()Returns
getTextRange
public String getTextRange(int start, int end)Parameters
startint- from
endint- to
Returns
rectForOffset
public int[] rectForOffset(int offset)Parameters
offsetint- the offset
Returns
{x, y, width, height} in screen coordinatesoffsetAtPoint
public int offsetAtPoint(int x, int y)Parameters
xint- screen x
yint- screen y
Returns
selectionRects
public int[] selectionRects(int start, int end)Parameters
startint- from
endint- to
Returns
{x, y, w, h}replaceRange
public void replaceRange(int start, int end, String text)Parameters
startint- from
endint- to
textString- the replacement
setSelectionRange
public void setSelectionRange(int start, int end)Parameters
startint- the anchor
endint- the caret