bookExamples.ch44Printing
Class DYMOLabelPrintConnector
java.lang.Object
bookExamples.ch44Printing.DYMOLabelPrintConnector
- All Implemented Interfaces:
- java.awt.print.Printable
public class DYMOLabelPrintConnector
- extends java.lang.Object
- implements java.awt.print.Printable
Print Labels for DYMO LabelWriter 400
- Version:
- $Revision$
- Author:
- Martin Scholz
Field Summary |
static java.lang.String |
PRINTERNAME
name of the printer as known in the settings. |
static boolean |
PRINTMENU
true if you want a menu to select the printer |
Fields inherited from interface java.awt.print.Printable |
NO_SUCH_PAGE, PAGE_EXISTS |
Method Summary |
int |
getPageNumbers()
|
java.lang.String |
getValue(int elementOnLabel,
int labelCounter)
overwrite this method in order to get other values. |
static void |
main(java.lang.String[] args)
GO ! |
int |
print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PRINTERNAME
public static final java.lang.String PRINTERNAME
- name of the printer as known in the settings.
If you dont know the exact name, leave it empty
and set PRINTMENU to true - this will activate the menu.
- See Also:
- Constant Field Values
PRINTMENU
public static final boolean PRINTMENU
- true if you want a menu to select the printer
- See Also:
- Constant Field Values
DYMOLabelPrintConnector
public DYMOLabelPrintConnector()
main
public static void main(java.lang.String[] args)
- GO !
- Parameters:
args
- unused
getValue
public java.lang.String getValue(int elementOnLabel,
int labelCounter)
- overwrite this method in order to get other values. The current implementation will generate lables with 5 lines.
-
"SetupX"
-
"fiehnlab.ucd"
-
"id" + the current counter number
-
"label" + the position
-
the current date
- Parameters:
elementOnLabel
- position of the field ON the label.labelCounter
- counter of ALL labels - first label is 0
- Returns:
- the value for the specific field
print
public int print(java.awt.Graphics graphics,
java.awt.print.PageFormat pageFormat,
int pageIndex)
throws java.awt.print.PrinterException
- Specified by:
print
in interface java.awt.print.Printable
- Throws:
java.awt.print.PrinterException
getPageNumbers
public int getPageNumbers()
- Returns:
- index of the last page.