ola galera estou querendo imprimir, mas nao sei como passar o texto pra classe
import java.awt.*;
import java.awt.geom.*;
import java.awt.print.*;
public class Main implements Printable {
private final double INCH = 72;
26: */
public Main () {
PrinterJob printJob = PrinterJob.getPrinterJob ();
printJob.setPrintable (this);
if (printJob.printDialog()) {
try {
printJob.print();
} catch (Exception PrintException) {
PrintException.printStackTrace();
}
}
}
public int print (Graphics g, PageFormat pageFormat, int page)
{
int i;
Graphics2D g2d;
Line2D.Double line = new Line2D.Double ();
//--- Validate the page number, we only print the first page
if (page == 0)
{
return (PAGE_EXISTS);
}
else
{
return (NO_SUCH_PAGE);
}
}
public static void main(String args[])
{
Main m = new Main();
}
}
grato