How to append html formatted text to JPaneText?

Hi,
I'm trying to append html to JPaneText and I can't do it. My code is below:
import java.awt.*;
import javax.swing.*;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.*;
import javax.swing.text.*;
public
class GUI
extends JFrame {
     JTextPane wynikTxtAre = new JTextPane();
     JScrollPane suwak = new JScrollPane(wynikTxtAre);
     JPanel panelSrodek = new JPanel();
     HTMLDocument doc;
     HTMLEditorKit kit = new HTMLEditorKit();
     public GUI()
super.setSize(640, 480);
super.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
wynikTxtAre.setEditable(false);
wynikTxtAre.setDocument(kit.createDefaultDocument());
doc = (HTMLDocument)wynikTxtAre.getDocument();
suwak.setPreferredSize(new Dimension(600, 400));
panelSrodek.add(suwak);
super.getContentPane().setLayout(new BorderLayout());
super.getContentPane().add("Center", panelSrodek);
super.setVisible(true);     
     public static void main (String [] args) {
          GUI g = new GUI();
          try {
     Style style = g.doc.addStyle("StyleName", null);
     StyleConstants.setItalic(style, true);
     StyleConstants.setFontSize(style, 30);
     StyleConstants.setBackground(style, Color.blue);
     StyleConstants.setForeground(style, Color.white);
     // Append to document
     g.kit.insertHTML(g.doc, g.doc.getLength(), "tekxt", 1, 1, HTML.Tag.B);
     //g.doc.insertString(g.doc.getLength(), "<b>Some Text</b>", style);
     } catch (Exception e) {
          System.out.println(e.getMessage());
If i use insertHTML method then there is no text on the text area.
If i use insertString method then text appear but it doesn't resolve html tags.
Please help.

I did something like this:
public
class GUI
extends JFrame {
//previous code - no changes
     public static void main (String [] args) {
          GUI g = new GUI();
          StringBuffer buf = new StringBuffer();
          try {
     buf.append("<b>bb</b>");
     buf.append("<b>ccc</b>");
     // First append to document
     g.pane.setText(buf.toString());
//Second append
     buf.append("<b>ddddd</b>");
     g.pane.setText(buf.toString());
     } catch (Exception e) {
          System.out.println(e.getMessage());
I know that this method is not smart and doesn't look good, but it works.
If you know how to append html using HTMLEditorKit and HTMLDocument please write some example.

Similar Messages

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • How Do I Display HTML Formatted Text From A Data Table In Crystal Reports?

    I'm creating reports in Crystal XI.  The information being displayed in the reports comes from data tables where the text is formatted in HTML.
    I've worked with Crystal Reports enough to know that HTML text pulled from a data table doesn't appear in Crystal the same way it does in a web browser.  Crystal Reports ignores all the tags (...unless I'm missing something...) and just displays the text.
    Someone far more Crystal savy than I (...who I don't have access to...) came up with a Formula Field workaround that tricks Crystal Reports into displaying some basic HTML tags.  Here's that workaround:
    <!--
    stringVar TableName := ;
    TableName := Replace (TableName, "<ul>","<br> <br>");
    TableName := Replace (TableName, "<li>", "<br>   &bull; ");
    TableName := Replace (TableName, "</li>", "");
    TableName := Replace (TableName, "</ul>","<br> <br>");
    TableName := Replace (TableName, "<a", "<u><font color='blue'");
    TableName := Replace (TableName, "</a>", "</font></u>");
    TableName
    -->
    QUESTION - Does any similar workaround exist so I can display an HTML Table in Crystal Reports?  If not, is there any way to display HTML formatted text from a data table in Crystal Reports as it would appear in a web browser?

    Hi Steven,
    To display html text in Crystal Reports follows these steps.
    1. Right click on the field and select Paragraph tab.
    2. Under 'Text Interpretation' select 'HTML Text' and click OK.
    I have tried using the way,but it never works.So reply me if there is any way to solve the issue

  • How to SEND HTML formatted mail??

    How do I put HTML formatted text into an email I want to SEND? -- "Paste as HTML" in edit menu is dimmed, and I can't get it to un-dim... I want to paste formatted text from an HTML editor into an email... can I do this with Mail, or do I need some other app to do this?

    AHHHH
    What you can do to make HTML for Apple Mail is to make it in an HTML editor, open it with Safari use CMD+i - a new mail message will appear in a moment with the web page in the email body.
    You can't do any major editing in Mail, you'll have to go back to the HTML file. But it works.
    You can also use Copy (from a web page) and then (Edit) Paste as HTML (that what Paste as HTML is for, not for creating HTML email). You can also user Paste as HTML to copy/paste a HTML email you receive or part of a HTML email.

  • How to create Using Formatted Text Field with multiple Sliders?

    Hi i found the Java Sun tutorial at http://java.sun.com/docs/books/tutorial/uiswing/components/slider.html very useful, and it tells how to create one Formatted Text Field with a Slider - however i need to create Formatted Text Field for multiple Sliders in one GUI, how do i do this?
    my code now is as follows, and the way it is now is scroll first slider is okay but scrolling second slider also changes value of text field of first slider! homework due tomorrow, please kindly help!
    // constructor
    label1 = new JLabel( "Individuals" );
    scroller1 = new JSlider( SwingConstants.HORIZONTAL,     0, 100, 10 );
    scroller1.setMajorTickSpacing( 10 );
    scroller1.setMinorTickSpacing( 1 );
    scroller1.setPaintTicks( true );
    scroller1.setPaintLabels( true );
    scroller1.addChangeListener(this);
    java.text.NumberFormat numberFormat = java.text.NumberFormat.getIntegerInstance();
    NumberFormatter formatter = new NumberFormatter(numberFormat);
            formatter.setMinimum(new Integer(0));
            formatter.setMaximum(new Integer(100));
    textField1 = new JFormattedTextField(formatter);
    textField1.setValue(new Integer(10)); //FPS_INIT
    textField1.setColumns(1); //get some space
    textField1.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField1.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField1.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField1.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField1.selectAll();
                    } else try {                    //The text is valid,
                        textField1.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    label2 = new JLabel( "Precision" );
    scroller2 = new JSlider( SwingConstants.HORIZONTAL, 0, 100, 8 );
    scroller2.setMajorTickSpacing( 10 );
    scroller2.setMinorTickSpacing( 1 );
    scroller2.setPaintTicks( true );
    scroller2.setPaintLabels( true );
    scroller2.addChangeListener(this);
    textField2 = new JFormattedTextField(formatter);
    textField2.setValue(new Integer(10)); //FPS_INIT
    textField2.setColumns(1); //get some space
    textField2.addPropertyChangeListener(this);
    //React when the user presses Enter.
    textField2.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0),  "check");
            textField2.getActionMap().put("check", new AbstractAction() {
                public void actionPerformed(ActionEvent e) {
                    if (!textField2.isEditValid()) { //The text is invalid.
                        Toolkit.getDefaultToolkit().beep();
                        textField2.selectAll();
                    } else try {                    //The text is valid,
                        textField2.commitEdit();     //so use it.
                    } catch (java.text.ParseException exc) { }
    // State Changed
         public void stateChanged(ChangeEvent e) {
             JSlider source = (JSlider)e.getSource();
             int fps = (int)source.getValue();
             if (!source.getValueIsAdjusting()) { //done adjusting
                  if(source==scroller1)   {
                       System.out.println("source ==scoller1\n");
                       textField1.setValue(new Integer(fps)); //update ftf value
                  else if(source==scroller2)     {
                       System.out.println("source ==scoller2\n");
                       textField2.setValue(new Integer(fps)); //update ftf value
             } else { //value is adjusting; just set the text
                 if(source==scroller1)     textField1.setText(String.valueOf(fps));
                 else if(source==scroller2)     textField2.setText(String.valueOf(fps));
    // Property Change
        public void propertyChange(PropertyChangeEvent e) {
            if ("value".equals(e.getPropertyName())) {
                Number value = (Number)e.getNewValue();
                if (scroller1 != null && value != null) {
                    scroller1.setValue(value.intValue());
                 else if (scroller2 != null && value != null) {
                    scroller2.setValue(value.intValue());
        // ACTION PERFORMED
        public void actionPerformed(ActionEvent event) {
        if (!textField1.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField1.selectAll();
        } else try {                    //The text is valid,
            textField1.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
             if (!textField2.isEditValid()) { //The text is invalid.
            Toolkit.getDefaultToolkit().beep();
            textField2.selectAll();
        } else try {                    //The text is valid,
            textField2.commitEdit();     //so use it.
        } catch (java.text.ParseException exc) { }
    ...

    if :p3_note_id is null
    then
    insert into notes (project_id, note, notes_month, notes_year) So, p3_note_id is NULL.
    Another option is that you have a trigger on table NOTES that generates a new note_id even for an update.

  • How to enable HTML formatted emails in nokia e72?

    Can anybody tell me that how to enable HTML formatted emails in nokia e72? I Owned a E71 & it has such a feature that I can activate HTML formatted email & Non-HTML formated emails. But I don't find any feature in Nokia E72. I receive all the mails as text messages. I use Other Emails Thanks in advace!

    No supporting stuff here, amigo. This e-mail procedure is a safety precaution. Html might contain malicious code. Try Profimail for a while.
    http://www.lonelycatgames.com/?app=profimail
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • How can I export formatted text from a string indicator?

    Does someone know how I can export formatted text (i.e., parts of the text have different formatting, such as color, fontsize, etc.) from a string indicator? Using copy/paste does not work, as it only exports unformatted plain text.

    Hello Sparti,
        Thank you for your suggestions, they are all very useful, and I plan to use the HTML feature under Report Generation to export the formatted text from Labview. However, I am still not sure how I can extract the formatted text from a *string indicator* and transfer it to one of those VIs, so that it can be exported to other applications. Let me give some more specific info on what I am trying to achieve:  I am monitoring the communication between two pieces of equipment. A string indicator shows all the data flow, with different colors for data coming from different instruments. I managed to do that by using a property node and playing with the selection and font color properties. Now, if you just wire the output of the string indicator, the formatting is gone and all you get is just plain black text (for instance, try to programmatically transfer the formatted text from one string indicator to a different string indicator and you will see that the formatting is not preserved). Even if you try the "brute force" method of manually selecting and copying the text in the indicator and pasting it to Word, LV does not export the formatting. But, if you paste *within*  LV (for example, paste it to a string constant in your diagram), then it works. To extract the formatted string from the indicator, I also tried to use a property node, but without success. I am trying to avoid duplicating part of my code to generate the same color-coding scheme on a report. It would be way easier to be able to transfer the formatted text from the string indicator. This is particularly annoying, because the information is there, stored in the data structure associated with the string indicator. But how can I put my hands on it? Any ideas?

  • How to send HTML Format Mail using Java Mail in oracle 9i Forms

    Dear All
    could you please tell me how to send HTML Format Mail using Java Mail in oracle 9i Forms and how to implement the java mail ?
    if it is possible, could you please send me the sample code? please very urgent
    Thanks
    P.Sivaraman

    Hello,
    <p>Here is a Form sample.</p>
    Francois

  • How to append paragraph in text file of TextEdit application using applescript

    how to append paragraph in text file of TextEdit application using applescript and how do i save as different location.

    christian erlinger wrote:
    When you want to print out an escape character in java (java is doing the work in client_text_io ), you'd need to escape it.
    client_text_io.put_line(out_file, replace('your_path', '\','\\'));cheersI tried replacing \ with double slash but it just printed double slash in the bat file. again the path was broken into two lines.
    file output
    chdir C:\\DOCUME~1\
    195969\\LOCALS~1\\Temp\
    Edited by: rivas on Mar 21, 2011 6:03 AM

  • Javafx 1.3 with swinglabel displaying html formated texts

    Dear FX experts,
    I am using swinglabel to display html formated text, and it worked fine with the fx 1.2. However, as I moved to 1.3, the showing of the text is not so proper, because I want the content of the swinglabel be shown in the middle of the box(the label itself) I set. However, in 1.2 it's ok, but 1.3 gives me headache: it's not shown on the place it should be, like it's ignoring all the centering attribute I tried to declare...
    any ideas? or suggestions? or solution?
    (ps, it keeps saying a warning if I used the class under ext package, since swingLabel is under ext... maybe it means I can use another class to do this? but I can't find any...)
    my codes would be like the followings:
    public def contentLabel: SwingLabel = SwingLabel {
    text: "<html\><font size=6>test test</font></html>"
    width: 400
    height: 500
    horizontalAlignment: SwingHorizontalAlignment.CENTER
    public function run(){
    Stage {
        title:"test"
        scene: Scene {
             width: 800
             height: 600
             content: [contentLabel]
    }Edited by: 880613 on 20.08.2011 16:41
    Edited by: 880613 on 21.08.2011 05:13

    No one knows about this?
    the SwingLabel or all Class files under ext packages are simply going to be replaced but without substitutors???

  • Display issue with HTML formatted text in report builder

    I am using the FCKeditor in my application to allow endusers
    the ability to create formated text on reports. We curently are
    experiencing 2 issues: 1. If you copy and paste from MS Word
    2003/2007 it will not display the text correclty in the report; 2.
    If you use the FCKeditor toolbar to insert bullets or a numeric
    list it will not align the text correctly on the report. We are
    using Coldfusion 8 with Hotfix 1 and Coldfusion Report Builder's
    lastest build release.
    Has one experiences this same issue with HTML fields not
    printing correctly using the Report Builder? What other HTML
    editors besides FCKeditor might we use?
    Thanks,
    Dan VanWieren

    Can you tell me how to use </td> for each values
    Give me your example report - using before or after report
    Thanks
    MT
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by fdenis:
    Hi Gavin,
    If I understand well, your HTML tags are coded directly in your fields in the database, right? Because if it was not the case, you could have use a format trigger checking for which destination you're generating your report...
    if UPPER(:DESFORMAT) = 'HTML' or
    UPPER(:DESFORMAT) = 'HTMLCSS'
    then
    -- insert your HTML code in the value
    -- of your field. something like...
    newValue := '<B>' | | :YOUR_FIELD | | '</B>
    srw.set_field_char( 0, newValue );
    else
    -- when generating to other format,
    -- you'd have to add the formatting as
    -- you want.
    end if
    return( true );
    Of course, if it's not acceptable to remove the HTML tag from your database fields, you could develop a procedure that would translate your HTML tags to the good formatting (eurk... ;-)
    Good luck... :-)
    Frederic
    <HR></BLOCKQUOTE>
    null

  • Exceptions for JLabel with HTML format text.

    Hi,
    When the follow code been runing, and press the "Submit" button,
    the follow exceptions are thrown.
    How could I got a right result?
    I could not find a way to work out it, and need a export help me.
    Thanks and Best Regards.
    Xue
    JFrame f=new JFrame();
              JPanel p=new JPanel(new BorderLayout());
         JLabel label=new JLabel();
         label.setForeground(Color.blue);
         StringBuffer sb=new StringBuffer();
         sb.append("<html>");
         sb.append("<head>");
         sb.append("</head>");
         sb.append("<body>");
         sb.append("<p>A<font color=\"#FF0000\">BCD</font>E<font color=\"#FF0000\">F</font>G</p>");
         sb.append("<form method=\"POST\" action=\"http://openelec.vicp.net:8080/\">");     
         sb.append("<p>Text:<input type=\"text\" name=\"T1\" size=\"20\"><input type=\"submit\" value=\"Submit\" name=\"B1\"><input type=\"reset\" value=\"Cancel\" name=\"B2\"></p>");
         sb.append("</form>");
         sb.append("<table border=\"1\" width=\"100%\" id=\"table1\">");
         sb.append("<tr>");
         sb.append("<td align=\"center\">Name</td>");
         sb.append("<td align=\"center\">Desc</td>");
         sb.append("</tr>");
         sb.append("<tr>");
         sb.append("<td align=\"center\"><font color=\"red\"><i>Xue Chen</i></font></td>");
         sb.append("<td align=\"left\">I am a Chinese. </td>");
         sb.append("</tr>");
         sb.append("</table>");
         sb.append("</body>");
         sb.append("</html>");
         label.setSize(600,400);     
         label.setText(sb.toString());
         p.add(label,BorderLayout.CENTER);
         f.getContentPane().add(p,BorderLayout.CENTER);
         f.setSize(new Dimension(600,300));
         f.setVisible(true);     
    Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.JLabel cannot be cast to javax.swing.JEditorPane
         at javax.swing.text.html.FormView.submitData(FormView.java:409)
         at javax.swing.text.html.FormView.actionPerformed(FormView.java:356)
         at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
         at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
         at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
         at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
         at java.awt.Component.processMouseEvent(Component.java:6038)
         at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
         at java.awt.Component.processEvent(Component.java:5803)
         at java.awt.Container.processEvent(Container.java:2058)
         at java.awt.Component.dispatchEventImpl(Component.java:4410)
         at java.awt.Container.dispatchEventImpl(Container.java:2116)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
         at java.awt.Container.dispatchEventImpl(Container.java:2102)
         at java.awt.Window.dispatchEventImpl(Window.java:2429)
         at java.awt.Component.dispatchEvent(Component.java:4240)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

    Hello,
    Thanks for you answer.
    There is a hard problem for this topic.
    how can I get the text value from text field in the html?
    I can got the Document object of the html in implement interface HyperlinkListener.
    Example, I input some chars in the text field<input type="text" name="T1" id="textField">.
    but I can not get the text that I input in the frame.
    Thanks and Best Regards
    here are the codes:
    * Called when a hypertext link is updated.
    * @param e the event responsible for the update
    public void hyperlinkUpdate(HyperlinkEvent e){
         Object src=e.getSource();
         //System.out.println(src);
         HTMLDocument doc=(HTMLDocument)e.getSourceElement().getDocument();//.getDefaultRootElement().getElementCount();
         Element el=doc.getElement("textField");//doc.getDefaultRootElement();
         System.out.println(el.toString());
         if(el!=null){                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How assign an HTML format in a Prompt

    I want to build а prompt with hierarchy list, so strings are padding by blanks. But OBIEE remove blanks. To avoid this OBIEE issue we must replace blanks on nbsp. But how I may to say OBIEE that the column in html format? It's easy for reports, but how do it for prompts?
    Edited by: AnTonic on Dec 22, 2009 6:21 PM

    hi,
    please look into this
    Re: Chane Name(Title) of Delivered Dashboard
    here if u select that option you can set html or css for prompt
    thanks,
    saichand.v

  • JTextPane - HTML Formatted text Overlap!!!!!!!!!!

    The formatted text overlaps in the printed sheet, but
    it is displayed correctly in the JTextPane
    Code is below:
    import java.awt.*;
    import javax.swing.*;
    import java.awt.print.*;
    class Test implements Printable {
    static JTextPane pane;
    static public void main(String args[]){
    pane = new JTextPane();
    pane.setContentType("text/html");
    pane.setText("<html>"
    +"<font face=Serif size=-1>plain<b>bold</b>plain</font><br>"
    +"<font size=+0>plain<b>bold</b>plain</font><br>"
    +"<font size=+1>plain<b>bold</b>plain</font><br>"
    +"<font size=-1>...................................plain<b>bold</b>plain</font><br>"
    +"<font size=+0>...................................plain<b>bold</b>plain</font><br>"
    +"<font size=+1>...................................plain<b>bold</b>plain</font><br>"
    +"<font size=-1>.......................................................................plain<b>bold</b>plain</font><br>"
    +"<font size=+0>.......................................................................plain<b>bold</b>plain</font><br>"
    +"<font size=+1>.......................................................................plain<b>bold</b>plain</font><br>"
    +"<font size=-1>@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=+0>@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=+1>@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=-1>@@@@@@@@@@@@@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=+0>@@@@@@@@@@@@@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=+1>@@@@@@@@@@@@@@@@@@@@@@plain<b>bold</b>plain</font><br>"
    +"<font size=-1>plain<i>italic</i>plain</font><br>"
    +"<font size=+0>plain<i>italic</i>plain</font><br>"
    +"<font size=+1>plain<i>italic</i>plain</font><br>"
    +"<font size=-1>...................................plain<i>italic</i>plain</font><br>"
    +"<font size=+0>...................................plain<i>italic</i>plain</font><br>"
    +"<font size=+1>...................................plain<i>italic</i>plain</font><br>"
    +"<font size=-1>.......................................................................plain<i>italic</i>plain</font><br>"
    +"<font size=+0>.......................................................................plain<i>italic</i>plain</font><br>"
    +"<font size=+1>.......................................................................plain<i>italic</i>plain</font><br>"
    +"<font size=-1>@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"<font size=+0>@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"<font size=+1>@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"<font size=-1>@@@@@@@@@@@@@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"<font size=+0>@@@@@@@@@@@@@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"<font size=+1>@@@@@@@@@@@@@@@@@@@@@@plain<i>italic</i>plain</font><br>"
    +"</html>");
    JFrame frame = new JFrame("Printing test");
    frame.getContentPane().add(pane);
    frame.setSize(600,800);
    frame.setVisible(true);
    PrinterJob job = PrinterJob.getPrinterJob();
    job.setPrintable(new Test(), job.defaultPage());
    if (job.printDialog()) {
    try { job.print(); }
    catch (Exception e) { }
    System.exit(0);
    public int print(Graphics g, PageFormat pf, int pageIndex) throws PrinterException {
    if (pageIndex >= 1) return Printable.NO_SUCH_PAGE;
    Graphics2D g2d = (Graphics2D)g;
    g2d.translate((int)pf.getImageableX(), (int)pf.getImageableY());
    g2d.setClip(0, 0, (int)pf.getImageableWidth(), (int)pf.getImageableHeight());
    try { pane.print(g2d); }
    catch (Exception e) { }
    return Printable.PAGE_EXISTS;
    The bold text overlaps

    I think the textpane wisth has is not adustable to theformatted text to acccomodate

  • Email html formatted (Text) printing quality issue on hp 6500a (710a)

    I experience some quality problems printing html formatted mails (not attachments, only standard text). The characters are printed with different free space between every char. There is no special sign or format. It happens from different note/netbooks/iphone.
    Pure email-Text-Printing is ok (same text), Attachment-Printing (word-doc arial text only) is ok (same text).
    The  printer has the actual firmware, alle computers and iphone are uptodate. Reset is no solution. Problems are reproducable on other hp 6500 series printers.
    See attached example

    kaaemm,
    Unfortunately, HTML formatted emails are not currently supported. They may go through and print, but results will vary. Only HTML attachments are supported at this time.
    ============================
    If I have solved your issue, please feel free to provide kudos and make sure you mark this thread as solution provided!
    Although I work for HP, my posts and replies are my own opinion and not those of HP.

Maybe you are looking for