Background Image in JTextPane

Posted by Nivas on Stack Overflow See other posts from Stack Overflow or by Nivas
Published on 2010-03-31T06:29:25Z Indexed on 2010/03/31 6:33 UTC
Read the original article Hit count: 587

Filed under:
|
|

How do I set a background image to a JTextPane - some sort of a watermark.

I tried this option - creating a child class of JTextPane and use the paint method to draw the image. But then the text is displayed "below" the image than above.

Is there any "standard" or "well known" way to do this?

(BTW, I tried (something silly?) making the content type "text/html", and setting the image as the background image of a <div> but it did not help.)

© Stack Overflow or respective owner

Related posts about swing

Related posts about jtextpane

  • base64 image into JTextPane

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Is it possible to display a base64 encrypted image into a JTextPane ? Here my code JTextPane jTextPane = new JTextPane(); javax.swing.text.html.HTMLEditorKit eKit = new javax.swing.text.html.HTMLEditorKit(); jTextPane.setEditorKit(eKit); jTextPane.setContentType("text/html"); // my base64 image… >>> More

  • Background Image in JTextPane

    as seen on Stack Overflow - Search for 'Stack Overflow'
    How do I set a background image to a JTextPane - some sort of a watermark. I tried this option - creating a child class of JTextPane and use the paint method to draw the image. But then the text is displayed "below" the image than above. Is there any "standard" or "well known" way to do this? (BTW… >>> More

  • Java JTextPane Save

    as seen on Stack Overflow - Search for 'Stack Overflow'
    i was trying to do some simple text formatting using JEditorPane but then as knowledge grew i found JTextPane easier to implement and more robust. my query is how do i save the formatted text in JTextPane to file? it should be RTF or HTML or other.. as this file is not opened by the application again… >>> More

  • Java Simple Chat Box

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I am trying to create a very simple chat window that simply has the ability to display some text, which i add to from time to time. However I get the following run time error when attempting to append text to the window: java.lang.ClassCastException: javax.swing.JViewport cannot be cast to javax… >>> More

  • Changing content of HTMLDocument displayed in a JTextPane

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I'm displaying some tables as HTML code (rendered by a Freemarker template) with a JTextPane. I also have some HTML links in this HTML output which can be used to interact with the values of the table (For example "Delete a row" and stuff like this). Currently I always recreate the whole HTML output… >>> More