There is a method you can call to check whether the Desktop API is available, called isDesktopSupported (see the link for more explanation). It is cross-platform, but may not be supported everywhere. StyledDocument doc = textPane.getStyledDocument() įor (int i=0 i < initString.You can do that with: ().edit(file) Here is the code from the TextSamplerDemo example that creates and initializes a text pane. You can embed images in an editor pane, too, but only by including the images in an HTML or RTF file. Through the API provided in the JTextPane class, you can embed images and components in a text pane.The JTextPane class itself contains many methods for working with styles that simply call methods in its document or editor kit. Through their styled document and styled editor kit, text panes provide support for named styles and logical styles.Be aware that the read and write methods for StyleEditorKit work with plain text. A text pane also requires that its editor kit be an instance of a StyledEditorKit (or a subclass). ![]() The Swing text package provides a default implementation of this interface, DefaultStyledDocument, which is the document that text panes use by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |