(我改写了原来的问题,问题是一样的。)从JEditorPane打印
上面的例子代码不打印图像。它出现在窗口中但未打印。
public static void main(String[] args) {
final JEditorPane ed = new JEditorPane(
"text/html",
"<p>Test<br><img src='http://www.google.es/images/logos/ps_logo2.png'></p>");
JFrame f = new JFrame();
f.setLayout(new BorderLayout());
f.add(ed);
JButton b = new JButton("Print");
f.add(b,BorderLayout.SOUTH);
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
try {
ed.print();
} catch (PrinterException ex) {
System.err.println(ex);
}
}
});
f.pack();
f.setVisible(true);
}
非常感谢! – ruX 2013-05-22 17:57:22
Java有View,ImageView?我知道它来自Android ... – barwnikk 2013-11-18 00:48:38