0

From my webpage i am calling applet that having some credential information and try to print the applet content. But i need to invisible the applet information. The paper coming as a blank if suppose the i am trying to invisible editorpane or Jframe.

    //Print function

        Graphics2D g2d = (Graphics2D) g;
        g2d.translate(pageFormat.getImageableX(), pageFormat
                .getImageableY());
        disableDoubleBuffering(componentToBePrinted);
        componentToBePrinted.paint(g2d);
        enableDoubleBuffering(componentToBePrinted);
        return (PAGE_EXISTS);

   // applet    

    jbInit();  
    this.accessParamEditorPane.setEditable(false);
    Font f = new Font("Arial", 1, 9);
    this.accessParamEditorPane.setFont(f);
    this.accessParamEditorPane.setText(Body);
    //this.setVisible(false);
    //accessParamEditorPane.setVisible(false);
    new PrintModule(this);
    dispose();
    setFocusableWindowState(false);
3
  • 1
    Don't use paint, use print or printAll...You won't need to disable double buffering, as this is what these methods do, also, you may need to ensure that the component being printed actually has been size properly Commented Sep 5, 2013 at 7:09
  • I tried with printAll function..but i couldn't acheived..and also checked the component size.. Commented Sep 5, 2013 at 7:32
  • 1
    I've just done a little stand alone example and it works fine for me. Maybe you should consider providing a SSCCE Commented Sep 5, 2013 at 7:44

1 Answer 1

1

You can try to create another JEditorPane instance (visible one). Copy size of the original one, set the same EditorKit and set document obtained from the original one.

Then printAll() the new instance.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.