Example usage for Java javax.swing JTextPane fields, constructors, methods, implement or subclass
The text is from its open source code.
JTextPane() Creates a new JTextPane . | |
JTextPane(StyledDocument doc) Creates a new JTextPane , with a specified document model. |
void | addCaretListener(CaretListener listener) Adds a caret listener for notification of any changes to the caret. |
void | addFocusListener(FocusListener l) Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void | addHyperlinkListener(HyperlinkListener listener) Adds a hyperlink listener for notification of any changes, for example when a link is selected and entered. |
void | addKeyListener(KeyListener l) Adds the specified key listener to receive key events from this component. |
void | addMouseListener(MouseListener l) Adds the specified mouse listener to receive mouse events from this component. |
void | addMouseMotionListener(MouseMotionListener l) Adds the specified mouse motion listener to receive mouse motion events from this component. |
Style | addStyle(String nm, Style parent) Adds a new style into the logical style hierarchy. |
ActionMap | getActionMap() Returns the ActionMap used to determine what Action to fire for particular KeyStroke binding. |
Border | getBorder() Returns the border of this component or null if no border is currently set. |
Rectangle | getBounds() Gets the bounds of this component in the form of a Rectangle object. |
Caret | getCaret() Fetches the caret that allows text-oriented navigation over the view. |
int | getCaretPosition() Returns the position of the text insertion caret for the text component. |
Object | getClientProperty(Object key) Returns the value of the property with the specified key. |
Document | getDocument() Fetches the model associated with the editor. |
EditorKit | getEditorKit() Fetches the currently installed kit for handling content. |
Font | getFont() Gets the font of this component. |
FontMetrics | getFontMetrics(Font font) Gets the FontMetrics for the specified Font . |
Highlighter | getHighlighter() Fetches the object responsible for making highlights. |
MutableAttributeSet | getInputAttributes() Gets the input attributes for the pane. |
InputMap | getInputMap() Returns the InputMap that is used when the component has focus. |
Insets | getInsets() If a border has been set on this component, returns the border's insets; otherwise calls super.getInsets . |
Style | getLogicalStyle() Fetches the logical style assigned to the paragraph represented by the current position of the caret, or null . |
Dimension | getPreferredSize() Returns the preferred size for the JEditorPane . |
String | getSelectedText() Returns the selected text contained in this TextComponent . |
int | getSelectionEnd() Returns the selected text's end position. |
int | getSelectionStart() Returns the selected text's start position. |
Style | getStyle(String nm) Fetches a named non- null style previously added. |
StyledDocument | getStyledDocument() Fetches the model associated with the editor. |
String | getText(int offs, int len) Fetches a portion of the text represented by the component. |
String | getText() Returns the text contained in this TextComponent in terms of the content type of this editor. |
TextUI | getUI() Fetches the user-interface factory for this text-oriented editor. |
void | insertComponent(Component c) Inserts a component into the document as a replacement for the currently selected content. |
void | insertIcon(Icon g) Inserts an icon into the document as a replacement for the currently selected content. |
Rectangle | modelToView(int pos) Converts the given location in the model to a place in the view coordinate system. |
boolean | print() A convenience print method that displays a print dialog, and then prints this JTextComponent in interactive mode with no header or footer text. |
boolean | print(final MessageFormat headerFormat, final MessageFormat footerFormat, final boolean showPrintDialog, final PrintService service, final PrintRequestAttributeSet attributes, final boolean interactive) Prints the content of this JTextComponent . |
void | putClientProperty(Object key, Object value) Adds an arbitrary key/value "client property" to this component. |
void | replaceSelection(String content) Replaces the currently selected content with new content represented by the given string. |
void | requestFocus() Requests that this Component gets the input focus. |
boolean | requestFocusInWindow() Requests that this Component gets the input focus. |
void | scrollRectToVisible(Rectangle aRect) Forwards the scrollRectToVisible() message to the JComponent 's parent. |
void | selectAll() Selects all the text in the TextComponent . |
void | setAutoscrolls(boolean autoscrolls) Sets the autoscrolls property. |
void | setBackground(Color bg) Sets the background color of this component. |
void | setBorder(Border border) Sets the border of this component. |
void | setBounds(int x, int y, int width, int height) Moves and resizes this component. |
void | setCaret(Caret c) Sets the caret to be used. |
void | setCaretPosition(int position) Sets the position of the text insertion caret for the TextComponent . |
void | setCharacterAttributes(AttributeSet attr, boolean replace) Applies the given attributes to character content. |
void | setContentType(String type) Sets the type of content that this editor handles. |
void | setCursor(Cursor cursor) Sets the cursor image to the specified cursor. |
void | setDocument(Document doc) Associates the editor with a text document. |
void | setEditable(boolean b) Sets the specified boolean to indicate whether or not this TextComponent should be editable. |
void | setEditorKit(EditorKit kit) Sets the currently installed kit for handling content. |
void | setEditorKitForContentType(String type, EditorKit k) Directly sets the editor kit to use for the given type. |
void | setFocusable(boolean focusable) Sets the focusable state of this Component to the specified value. |
void | setFont(Font font) Sets the font for this component. |
void | setForeground(Color fg) Sets the foreground color of this component. |
void | setHighlighter(Highlighter h) Sets the highlighter to be used. |
void | setLogicalStyle(Style s) Sets the logical style to use for the paragraph at the current caret position. |
void | setMargin(Insets m) Sets margin space between the text component's border and its text. |
void | setName(String name) Sets the name of the component to the specified string. |
void | setOpaque(boolean isOpaque) If true the component paints every pixel within its bounds. |
void | setPage(URL page) Sets the current URL being displayed. |
void | setParagraphAttributes(AttributeSet attr, boolean replace) Applies the given attributes to paragraphs. |
void | setPreferredSize(Dimension preferredSize) Sets the preferred size of this component. |
void | setSelectedTextColor(Color c) Sets the current color used to render the selected text. |
void | setSize(int width, int height) Resizes this component so that it has width width and height height . |
void | setText(String t) Sets the text of this TextComponent to the specified content, which is expected to be in the format of the content type of this editor. |
void | setToolTipText(String text) Registers the text to display in a tool tip. |
void | setTransferHandler(TransferHandler newHandler) Sets the TransferHandler , which provides support for transfer of data into and out of this component via cut/copy/paste and drag and drop. |
void | setVerifyInputWhenFocusTarget(boolean verifyInputWhenFocusTarget) Sets the value to indicate whether input verifier for the current focus owner will be called before this component requests focus. |
void | setVisible(boolean aFlag) Makes the component visible or invisible. |
int | viewToModel(Point pt) Converts the given place in the view coordinate system to the nearest representative location in the model. |