在我的网页上,我正在调用具有一些凭据信息的applet,并尝试打印applet内容。但我需要隐藏applet信息。如果假设我正在尝试隐形编辑器或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);
答案 0 :(得分:1)
您可以尝试创建另一个JEditorPane
实例(可见一个)。复制原始版本的大小,设置相同的EditorKit
并设置从原始文档中获取的文档。
然后printAll()
新实例。