Programming Examples

Are you a Programmer or Application Developer or a DBA? Take a cup of coffee, sit back and spend few minutes here :)

Tag Archive for ‘insertIcon’

JTextPane & Text Formatting

Java Swing JTextPane Example

The example is a JFrame Window which houses a JTextPane. Here, one can see the JTextPane Example displaying the content with a mixture of texts and images. The document displays heading text in blue colour and normal text in red colour. The heading text is slightly bigger than the normal text. Towards the end of the document, there will be document footer in green colour. This is not shown above.

Using this example, we will learn how to insert text and image into the JTextPane. At this moment, we can also visualize that we have three variations of the text and, in this example, we will group three types of text formatting styles to prepare the document.

Continue Reading →