Some Methods of the JEditorPane
Methods |
Description |
---|---|
setText(String text) |
Sets the text content of the editor pane. |
setPage(String url) |
Sets the page content from the specified URL. The content type is determined based on the URL’s file extension. |
setContentType(String type) |
Sets the content type of the editor pane (e.g., “text/plain,” “text/html,” “text/rtf”). |
setEditorKit(EditorKit kit) |
Sets the editor kit used to interpret and display the content. |
getDocument() |
Returns the document model associated with the editor pane. |
getContentType() |
Returns the content type of the editor pane. |
getEditorKitForContentType(String type) |
Returns the default editor kit for the specified content type. |
getCaret() |
Returns the caret (cursor) used for text editing. |
setEditable(boolean editable) |
Sets whether the editor pane is editable or not. |
getSelectedText() |
Returns the currently selected text. |
Java JEditorPane
A JEditorPane is a component in Java Swing that provides a simple way to display and edit HTML and RTF (Rich Text Format) content. It is a versatile component that allows you to display styled text, links, and images, making it useful for creating simple web browsers, rich-text editors, and content viewers within your Java applications. JEditorPane is a part of javax.swing package.
Contact Us