|
I still cannot figure out what AWT printing means.
Here is a sample describing that I want to print text in a textarea to printer
but instead of printing the text it just prints a blank textarea
:
...
import java.awt.print.*;
...
...
TextArea ta1;
...
public int print(Graphics g, PageFormat pf, int pi)
throws PrinterException
{
if (pi >= 1)
{
return
Printable.NO_SUCH_PAGE;
}
DrawIt(g);
return Printable.PAGE_EXISTS;
}
public void DrawIt(Graphics g)
{
Image img1;
img1 =
ta1.createImage(ta1.getSize().width,ta1.getSize().height);
g.drawImage(img1, 0, 0, this);
}
Anyone can
help? |
