Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

mmm, how to print from a JTextPane (or maybe from - DefaultStyledDocument)

843804Nov 21 2004 — edited Jul 3 2007
Hi guys,

Here is the deal:

I have a JTextPane with a logo (jpg) and Text.
how can I print all the information taken from the JTextPane.

my code looks like this:

protected JTextPane pane;
protected DefaultStyledDocument doc;
.
.
.
this.doc = new DefaultStyledDocument();
this.pane = new JTextPane(doc);
.
.
.//add logo
Icon icon = new ImageIcon("images/logo.jpg");
pane.insertIcon(icon);
.
.
.//add text
StyleConstants.setFontSize(attr, 12);
StyleConstants.setForeground(attr, Color.BLACK);
doc.insertString(doc.getLength(), "text comes here", attr);


Thanks for any help
Ppr
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 31 2007
Added on Nov 21 2004
6 comments
169 views