ch.aplu.util
Interface GPrintable
public interface GPrintable
Interface for printing on an attached printer.
Normally an application derives from GPanel (or uses
a GPanel) and implements this interface.
draw() should contain all drawing operations into the
GPanel. The printing occures, when GPanel's print() is
called.
Example:
import ch.aplu.util.*;
public class PrintTest extends GPanel implements GPrintable
{
public PrintTest()
{
draw(); // Draw on screen
print(this); // Draw on printer
}
public void draw()
{
move(0, 0);
draw(0, 1);
draw(1, 1);
draw(1, 0);
draw(0, 0);
line(0, 0, 1, 1);
line(0, 1, 1, 0);
}
public static void main(String[] args)
{
new PrintTest();
}
}
Method Summary |
void |
draw()
This method must perform all drawing operations. |
draw
void draw()
- This method must perform all drawing operations.
Be aware that for some undocumented reason
draw() is called twice. So be sure you initialize it correctly.