Printing image from JLabel (using Printer) using java netbeans -


I am using Java Netbeans and want to print the image with JLABB but its not working. If I am using TextArea.print () I just want to print the image, please help.

icon icon = Noska_Camela. Gate Icon (); BufferedImage bi = New BufferedImage (icon.getIconWidth), icon.getIconHeight (), BufferedImage.TYPE_INT_RGB); Graphics G = Two Character Graphics (); G.dispose (); Try {PrintAll (g); Joppenpen Shomos Digital (empty, "success"); } Hold (java.awt.print.PrinterException e) // An error {System.err.format ("%% can not be printed", E. Message ());

You are settling graphics objects before printing

  g.dispose (); Try {PrintAll (g); Joppenpen Shomos Digital (empty, "success"); } Hold (java.awt.print.PrinterException e) // An error {System.err.format ("%% can not be printed", E. Message ()); }  

should be

  try {printAll (g); Joppenpen Shomos Digital (empty, "success"); G.dispose (); } Hold (java.awt.print.PrinterException e) // An error {System.err.format ("%% can not be printed", E. Message ()); }  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -