| Modifiers | Name | Description |
|---|---|---|
static String |
AUTO_INDENT |
Action name for automatic indentation. |
static String |
DELETE |
Action name for backspace deletion. |
static String |
FIND |
Action name for opening the find dialog. |
static String |
FIND_NEXT |
Action name for repeating the next find. |
static String |
FIND_PREVIOUS |
Action name for repeating the previous find. |
static String |
REPLACE |
Action name for opening the replace dialog. |
| Fields inherited from class | Fields |
|---|---|
class JTextPane |
W3C_LENGTH_UNITS, HONOR_DISPLAY_PROPERTIES, FOCUS_ACCELERATOR_KEY, DEFAULT_KEYMAP, WHEN_FOCUSED, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_IN_FOCUSED_WINDOW, UNDEFINED_CONDITION, TOOL_TIP_TEXT_KEY, TOP_ALIGNMENT, CENTER_ALIGNMENT, BOTTOM_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT |
| Constructor and description |
|---|
TextEditor()Creates a new instance of TextEditor |
TextEditor(boolean tabsAsSpaces)Creates a new instance of TextEditor |
TextEditor(boolean tabsAsSpaces, boolean multiLineTab)Creates a new instance of TextEditor |
TextEditor(boolean tabsAsSpaces, boolean multiLineTab, boolean unwrapped)Creates a new instance of TextEditor |
| Type Params | Return Type | Name and description |
|---|---|---|
|
public void |
addNotify()Notifies this component that it now has a parent component. When this method is invoked, the chain of parent components is set up with KeyboardAction event listeners.
This method is called by the toolkit internally and should
not be called directly by programs.
|
|
public int |
getNumberOfPages()Returns the number of pages in the set. To enable advanced printing features, it is recommended that Pageable
implementations return the true number of pages
rather than the
UNKNOWN_NUMBER_OF_PAGES constant.
|
|
public PageFormat |
getPageFormat(int pageIndex)Returns the PageFormat of the page specified by
pageIndex.
|
|
public Printable |
getPrintable(int param)Returns the Printable instance responsible for
rendering the page specified by pageIndex.
|
|
public boolean |
getScrollableTracksViewportWidth()Returns true if a viewport should always force the width of this Scrollable to match the width of the viewport.
|
|
public boolean |
isMultiLineTabbed()Whether using the tab key indents the selected lines of code |
|
public void |
isMultiLineTabbed(boolean multiLineTab)Enables or disables indenting all selected lines when tabbing. |
|
public static boolean |
isOvertypeMode()
|
|
public boolean |
isTabsAsSpaces()
|
|
public void |
isTabsAsSpaces(boolean tabsAsSpaces)Enables or disables replacing typed tab characters with spaces. |
|
public boolean |
isUnwrapped()
|
|
public int |
print(Graphics graphics, PageFormat pageFormat, int page)Prints the page at the specified index into the specified Graphics context in the specified format. A PrinterJob calls the
Printable interface to request that a page be
rendered into the context specified by
graphics. The format of the page to be drawn is
specified by pageFormat. The zero based index
of the requested page is specified by pageIndex.
If the requested page does not exist then this method returns
NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned.
The Graphics class or subclass implements the
PrinterGraphics interface to provide additional
information. If the Printable object
aborts the print job then it throws a PrinterException.
|
|
protected void |
processKeyEvent(KeyEvent e)Overrides processKeyEvent to process events. * |
|
public void |
removeNotify() |
|
public void |
replaceSelection(String text)Replaces the currently selected content with new content represented by the given string. If there is no selection this amounts to an insert of the given text. If there is no replacement text this amounts to a removal of the current selection. The replacement text will have the attributes currently defined for input at the point of insertion. If the document is not editable, beep and return.
|
|
public void |
setBounds(int x, int y, int width, int height)Moves and resizes this component. The new location of the top-left corner is specified by x and y, and the
new size is specified by width and height.
This method changes layout-related information, and therefore, invalidates the component hierarchy.
|
|
public void |
setOvertypeMode(boolean isOvertypeMode)Set the caret to use depending on overtype/insert mode |
|
public void |
setUnwrapped(boolean unwrapped)
|
Action name for automatic indentation.
Action name for backspace deletion.
Action name for opening the find dialog.
Action name for repeating the next find.
Action name for repeating the previous find.
Action name for opening the replace dialog.
Creates a new instance of TextEditor
Creates a new instance of TextEditor
tabsAsSpaces - whether typed tabs should be converted to spacesCreates a new instance of TextEditor
tabsAsSpaces - whether typed tabs should be converted to spacesmultiLineTab - whether tab actions should affect all selected linesCreates a new instance of TextEditor
tabsAsSpaces - whether typed tabs should be converted to spacesmultiLineTab - whether tab actions should affect all selected linesunwrapped - whether long lines should avoid viewport wrapping Notifies this component that it now has a parent component.
When this method is invoked, the chain of parent components is
set up with KeyboardAction event listeners.
This method is called by the toolkit internally and should
not be called directly by programs.
Returns the number of pages in the set.
To enable advanced printing features,
it is recommended that Pageable
implementations return the true number of pages
rather than the
UNKNOWN_NUMBER_OF_PAGES constant.
Pageable. Returns the PageFormat of the page specified by
pageIndex.
Pageable does not contain the requested
page.pageIndex - the zero based index of the page whose
PageFormat is being requestedPageFormat describing the size and
orientation. Returns the Printable instance responsible for
rendering the page specified by pageIndex.
Pageable does not contain the requested
page.pageIndex - the zero based index of the page whose
Printable is being requestedPrintable that renders the page. Returns true if a viewport should always force the width of this
Scrollable to match the width of the viewport.
Whether using the tab key indents the selected lines of code
Enables or disables indenting all selected lines when tabbing.
multiLineTab - the new multiLine tab value
Enables or disables replacing typed tab characters with spaces.
tabsAsSpaces - whether tabs are converted to spaces
Prints the page at the specified index into the specified
Graphics context in the specified
format. A PrinterJob calls the
Printable interface to request that a page be
rendered into the context specified by
graphics. The format of the page to be drawn is
specified by pageFormat. The zero based index
of the requested page is specified by pageIndex.
If the requested page does not exist then this method returns
NO_SUCH_PAGE; otherwise PAGE_EXISTS is returned.
The Graphics class or subclass implements the
PrinterGraphics interface to provide additional
information. If the Printable object
aborts the print job then it throws a PrinterException.
graphics - the context into which the page is drawnpageFormat - the size and orientation of the page being drawnpageIndex - the zero based index of the page to be drawnpageIndex specifies a
non-existent page. Overrides processKeyEvent to process events. *
Replaces the currently selected content with new content represented by the given string. If there is no selection this amounts to an insert of the given text. If there is no replacement text this amounts to a removal of the current selection. The replacement text will have the attributes currently defined for input at the point of insertion. If the document is not editable, beep and return.
content - the content to replace the selection with Moves and resizes this component. The new location of the top-left
corner is specified by x and y, and the
new size is specified by width and height.
This method changes layout-related information, and therefore, invalidates the component hierarchy.
x - the new x-coordinate of this componenty - the new y-coordinate of this componentwidth - the new width of this componentheight - the new height of this
componentSet the caret to use depending on overtype/insert mode
isOvertypeMode - the new mode; true = overtype
unwrapped - the new unwrapped valueCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.