I have a JPanel
with two labels with pictures. I need to print these content of the JPanel
. Please help me out. How can I print only this JPa
just edit and put the name of your frame, panel(jPanel1) and button(print). 'this' refers to the JFrame class(i.e my class extends javax.swing.JFrame ) just put your frame's reference instead of 'this'.
private void PritnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Toolkit tkp = jPanel1.getToolkit();
PrintJob pjp = tkp.getPrintJob(this, null, null);
Graphics g = pjp.getGraphics();
jPanel1.print(g);
g.dispose();
pjp.end();
}