com.idautomation.datamatrix
Class DataMatrix

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Canvas
          extended bycom.idautomation.datamatrix.DataMatrix
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DataMatrix
extends java.awt.Canvas
implements java.io.Serializable

This is the main DataMatrix class that generates the DataMatrix barcode image.

See Also:
Serialized Form

Field Summary
 boolean autoSize
          If true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True.
 java.awt.Color backColor
          Background color.
 java.awt.Color barColor
          Color of the modules.
static int C104X104
           
static int C10X10
           
static int C120X120
           
static int C12X12
           
static int C12X26
           
static int C12X36
           
static int C132X132
           
static int C144X144
           
static int C14X14
           
static int C16X16
           
static int C16X36
           
static int C16X48
           
static int C18X18
           
static int C20X20
           
static int C22X22
           
static int C24X24
           
static int C26X26
           
static int C32X32
           
static int C36X36
           
static int C40X40
           
static int C44X44
           
static int C48X48
           
static int C52X52
           
static int C64X64
           
static int C72X72
           
static int C80X80
           
static int C88X88
           
static int C8X18
           
static int C8X32
           
static int C96X96
           
 java.lang.String code
          Data to be encoded in a Data Matrix symbol.
 java.lang.String codeText
          The text of the barcode after it is created.
 java.awt.Color demoColor
           
static int E_ASCII
           
static int E_AUTO
           
static int E_BASE256
           
static int E_C40
           
static int E_NONE
           
static int E_TEXT
           
 int encoding
          The encoding mode; valid values are E_ASCII (default), E_C40, E_TEXT or E_BASE256.
 java.awt.Color fontColor
          The color of the humam readable text; Default=black.
 int height
          Initial preferred height property of the bean
 double leftMarginCM
          The left margin of the barcode (also know as quiet zone); The default is .06 CM.
 double marginCM
          Margin of the Barcode (also know as quiet zone).
 java.lang.String mcheckdigit
           
 double N
          multiple value for width bars - should be 2.
 int pHeight
          The preferred height of the barcode image in pixels after barcode is generated.
 int preferredFormat
          The preferred format represented by a number; valid values are from 0 (10X10) to 23 (144X144) and from 24 (8X18) to 29 (16X48); The default value is -1 which sets this to automatic; this is also documented in the user manual.
 boolean processTilde
          If true, ("Y") the tilde (~) will be processed as explained in the Data Matrix user guide.
 int pWidth
          The preferred width of the barcode image in pixels after barcode is generated.
 boolean reBuild
           
 int resolution
          The resolution used to create the X dimension and other measurements in pixels; Default is 38 Pixels Per CM which is about 96 DPI.
 int rotate
          Rotation angle; valid values are 0 (default), 90, 180 & 270.
 boolean showHR
          If true, the human readable text will be displayed instead of the barcode Default is false.
 boolean singleLineHR
          When set to True and ShowHR is True, human readable data appears on a single line.
 java.awt.Font textFont
          The font of the text in the barcode; Default = Arial.
 double textMarginCM
          The amount of space in CM between the barcode and the human readable text.
 double topMarginCM
          The top margin of the barcode (also know as quiet zone); The default is .06 CM.
 int width
          Initial preferred width property of the bean
 double X
          The size in CM of modules, default is .06; usually adjustable in increments of .03CM because (X * resolution) is used to convert to pixels; use setPixelsPerCM to change; if X * resolution = < 1, X will be set to one pixel.
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DataMatrix()
           
 
Method Summary
 java.lang.String createEPS()
           
 java.lang.String createSVG()
           
 boolean getAutoSize()
          Gets the autoSize property.
 java.awt.Color getBackground()
          Gets the backColor property.
 java.lang.String getDataToEncode()
          Gets the code property.
 int getEncodingMode()
          Gets the encoding property.
 java.awt.Font getFont()
          Gets the textFont property value.
 java.awt.Color getForeground()
          Gets the barColor property.
 double getLeftMarginCM()
          Gets the leftMarginCM property.
 double getMarginCM()
          Gets the marginCM property.
 java.awt.Dimension getMinimumSize()
          Gets the minimum size in pixels of the barcode image generated.
 int getPixelsPerCM()
          Gets the resolution property.
 int getPreferredFormat()
          Gets the preferredFormat property.
 java.awt.Dimension getPreferredSize()
          Gets the size in pixels of the Preferred barcode image generated.
 boolean getProcessTilde()
          Gets the processTilde property.
 int getRotationAngle()
          Gets the rotate property.
 boolean getShowHR()
          Gets the showHR property value.
 boolean getSingleLineHR()
          Gets the showHR property value.
 java.awt.Color getTextFontColor()
          Gets the fontColor property value.
 double getTopMarginCM()
          Gets the topMarginCM property.
 double getXDimensionCM()
          Gets the X property.
 void paint(java.awt.Graphics g2)
          Paints the barcode and rotates it if necessary
 void setAutoSize(boolean newVal)
          Sets the autoSize property.
 void setBackground(java.awt.Color newColor)
          Sets the backColor property.
 void setDataToEncode(java.lang.String newCode)
          Sets the code property.
 void setEncodingMode(int newMode)
          Sets the encoding property.
 void setFont(java.awt.Font newFont)
          Sets the textFont property.
 void setForeground(java.awt.Color newColor)
          Sets the barColor property.
 void setImageSize(int imgWidth, int imgHeight)
          Sets the size of the generated image, if used then autoSize is set to false.
 void setLeftMarginCM(double newMargin)
          Sets the leftMarginCM property.
 void setMarginCM(double newMargin)
          Sets the marginCM property.
 void setPixelsPerCM(int newRes)
          Sets the resolution property.
 void setPreferredFormat(int newFormat)
          Sets the preferredFormat property.
 void setProcessTilde(boolean newVal)
          Sets the processTilde property.
 void setRotationAngle(int newRotate)
          Sets the rotate property.
 void setShowHR(boolean newVal)
          Sets the showHR property.
 void setSingleLineHR(boolean newVal)
          Sets the setSingleLineHR property.
 void setTextFontColor(java.awt.Color newColor)
          Sets the fontColor property.
 void setTopMarginCM(double newMargin)
          Sets the topMarginCM property.
 void setXDimensionCM(double newX)
          Sets the X property.
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

code

public java.lang.String code
Data to be encoded in a Data Matrix symbol.

See Also:
setDataToEncode(String newCode), getDataToEncode(), User Manual

mcheckdigit

public java.lang.String mcheckdigit

marginCM

public double marginCM
Margin of the Barcode (also know as quiet zone). The default is .06 CM

See Also:
setMarginCM(double newMargin), getMarginCM(), User Manual

topMarginCM

public double topMarginCM
The top margin of the barcode (also know as quiet zone); The default is .06 CM.

See Also:
setTopMarginCM(double newMargin), getTopMarginCM(), User Manual

leftMarginCM

public double leftMarginCM
The left margin of the barcode (also know as quiet zone); The default is .06 CM.

See Also:
setLeftMarginCM(double newMargin), getLeftMarginCM(), User Manual

backColor

public java.awt.Color backColor
Background color.

See Also:
setBackground(Color newColor), getBackground(), User Manual

codeText

public java.lang.String codeText
The text of the barcode after it is created.


resolution

public int resolution
The resolution used to create the X dimension and other measurements in pixels; Default is 38 Pixels Per CM which is about 96 DPI. 96 DPI is the resolution of the web browser; this setting works best when using the servlet. Enter 118 to create a 300 DPI image.

See Also:
setPixelsPerCM(int newRes), getPixelsPerCM(), User Manual

N

public double N
multiple value for width bars - should be 2.


X

public double X
The size in CM of modules, default is .06; usually adjustable in increments of .03CM because (X * resolution) is used to convert to pixels; use setPixelsPerCM to change; if X * resolution = < 1, X will be set to one pixel.

See Also:
setXDimensionCM(double newX), getXDimensionCM(), User Manual

width

public int width
Initial preferred width property of the bean


height

public int height
Initial preferred height property of the bean


pWidth

public int pWidth
The preferred width of the barcode image in pixels after barcode is generated.

See Also:
getPreferredSize(), User Manual

pHeight

public int pHeight
The preferred height of the barcode image in pixels after barcode is generated.

See Also:
getPreferredSize(), User Manual

autoSize

public boolean autoSize
If true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True.

See Also:
setAutoSize(boolean newVal), getAutoSize(), User Manual

barColor

public java.awt.Color barColor
Color of the modules.

See Also:
setForeground(Color newColor), getForeground(), User Manual

rotate

public int rotate
Rotation angle; valid values are 0 (default), 90, 180 & 270.

See Also:
setRotationAngle(int newRotate), getRotationAngle(), User Manual

processTilde

public boolean processTilde
If true, ("Y") the tilde (~) will be processed as explained in the Data Matrix user guide. If not, it will be treated as a normal character; Default =False.

See Also:
setProcessTilde(boolean newVal), getProcessTilde(), User Manual

showHR

public boolean showHR
If true, the human readable text will be displayed instead of the barcode Default is false.

See Also:
setShowHR(boolean newVal), #getHR(), User Manual

singleLineHR

public boolean singleLineHR
When set to True and ShowHR is True, human readable data appears on a single line. When false, human readable is split across multiple lines for GS1-DataMatrix

See Also:
setShowHR(boolean newVal), #getHR(), User Manual

textFont

public java.awt.Font textFont
The font of the text in the barcode; Default = Arial.

See Also:
setFont(Font newFont), getFont(), User Manual

textMarginCM

public double textMarginCM
The amount of space in CM between the barcode and the human readable text. Default is 0.3CM.

See Also:
#setTextMarginCM(double newMargin), #getTextMarginCM(), User Manual

fontColor

public java.awt.Color fontColor
The color of the humam readable text; Default=black.

See Also:
setTextFontColor(Color newColor), getTextFontColor(), User Manual

demoColor

public java.awt.Color demoColor

E_AUTO

public static int E_AUTO

E_ASCII

public static int E_ASCII

E_C40

public static int E_C40

E_TEXT

public static int E_TEXT

E_BASE256

public static int E_BASE256

E_NONE

public static int E_NONE

encoding

public int encoding
The encoding mode; valid values are E_ASCII (default), E_C40, E_TEXT or E_BASE256.

See Also:
setEncodingMode(int newMode), getEncodingMode(), User Manual

reBuild

public boolean reBuild

preferredFormat

public int preferredFormat
The preferred format represented by a number; valid values are from 0 (10X10) to 23 (144X144) and from 24 (8X18) to 29 (16X48); The default value is -1 which sets this to automatic; this is also documented in the user manual.

See Also:
setPreferredFormat(int newFormat), getPreferredFormat(), User Manual

C10X10

public static final int C10X10
See Also:
Constant Field Values

C12X12

public static final int C12X12
See Also:
Constant Field Values

C14X14

public static final int C14X14
See Also:
Constant Field Values

C16X16

public static final int C16X16
See Also:
Constant Field Values

C18X18

public static final int C18X18
See Also:
Constant Field Values

C20X20

public static final int C20X20
See Also:
Constant Field Values

C22X22

public static final int C22X22
See Also:
Constant Field Values

C24X24

public static final int C24X24
See Also:
Constant Field Values

C26X26

public static final int C26X26
See Also:
Constant Field Values

C32X32

public static final int C32X32
See Also:
Constant Field Values

C36X36

public static final int C36X36
See Also:
Constant Field Values

C40X40

public static final int C40X40
See Also:
Constant Field Values

C44X44

public static final int C44X44
See Also:
Constant Field Values

C48X48

public static final int C48X48
See Also:
Constant Field Values

C52X52

public static final int C52X52
See Also:
Constant Field Values

C64X64

public static final int C64X64
See Also:
Constant Field Values

C72X72

public static final int C72X72
See Also:
Constant Field Values

C80X80

public static final int C80X80
See Also:
Constant Field Values

C88X88

public static final int C88X88
See Also:
Constant Field Values

C96X96

public static final int C96X96
See Also:
Constant Field Values

C104X104

public static final int C104X104
See Also:
Constant Field Values

C120X120

public static final int C120X120
See Also:
Constant Field Values

C132X132

public static final int C132X132
See Also:
Constant Field Values

C144X144

public static final int C144X144
See Also:
Constant Field Values

C8X18

public static final int C8X18
See Also:
Constant Field Values

C8X32

public static final int C8X32
See Also:
Constant Field Values

C12X26

public static final int C12X26
See Also:
Constant Field Values

C12X36

public static final int C12X36
See Also:
Constant Field Values

C16X36

public static final int C16X36
See Also:
Constant Field Values

C16X48

public static final int C16X48
See Also:
Constant Field Values
Constructor Detail

DataMatrix

public DataMatrix()
Method Detail

setDataToEncode

public void setDataToEncode(java.lang.String newCode)
Sets the code property.

Parameters:
newCode - the new value for the code variable.
See Also:
code, User Manual

getDataToEncode

public java.lang.String getDataToEncode()
Gets the code property.

Returns:
the current value of the code variable.
See Also:
code, User Manual

setMarginCM

public void setMarginCM(double newMargin)
Sets the marginCM property.

Parameters:
newMargin - the new value for the marginCM variable.
See Also:
marginCM, User Manual

getMarginCM

public double getMarginCM()
Gets the marginCM property.

Returns:
the current value of the marginCM variable.
See Also:
marginCM, User Manual

setTopMarginCM

public void setTopMarginCM(double newMargin)
Sets the topMarginCM property.

Parameters:
newMargin - the new value for the topMarginCM variable.
See Also:
topMarginCM, User Manual

getTopMarginCM

public double getTopMarginCM()
Gets the topMarginCM property.

Returns:
the current value of the topMarginCM variable.
See Also:
topMarginCM, User Manual

setLeftMarginCM

public void setLeftMarginCM(double newMargin)
Sets the leftMarginCM property.

Parameters:
newMargin - the new value for the leftMarginCM variable.
See Also:
leftMarginCM, User Manual

getLeftMarginCM

public double getLeftMarginCM()
Gets the leftMarginCM property.

Returns:
the current value of the leftMarginCM variable.
See Also:
leftMarginCM, User Manual

setBackground

public void setBackground(java.awt.Color newColor)
Sets the backColor property.

Parameters:
newColor - the new value for the backColor variable.
See Also:
backColor, User Manual

getBackground

public java.awt.Color getBackground()
Gets the backColor property.

Returns:
the current value of the backColor variable.
See Also:
backColor, User Manual

setPixelsPerCM

public void setPixelsPerCM(int newRes)
Sets the resolution property.

Parameters:
newRes - the new value for the resolution variable.
See Also:
resolution, User Manual

getPixelsPerCM

public int getPixelsPerCM()
Gets the resolution property.

Returns:
the current value of the resolution variable.
See Also:
resolution, User Manual

setXDimensionCM

public void setXDimensionCM(double newX)
Sets the X property.

Parameters:
newX - the new value for the X variable.
See Also:
X, User Manual

getXDimensionCM

public double getXDimensionCM()
Gets the X property.

Returns:
the current value of the X variable.
See Also:
X, User Manual

setAutoSize

public void setAutoSize(boolean newVal)
Sets the autoSize property.

Parameters:
newVal - the new value for the autoSize variable.
See Also:
autoSize, User Manual

getAutoSize

public boolean getAutoSize()
Gets the autoSize property.

Returns:
the current value of the autoSize variable.
See Also:
autoSize, User Manual

setImageSize

public void setImageSize(int imgWidth,
                         int imgHeight)
Sets the size of the generated image, if used then autoSize is set to false.

See Also:
User Manual

getPreferredSize

public java.awt.Dimension getPreferredSize()
Gets the size in pixels of the Preferred barcode image generated.

Returns:
Dimension(pWidth,pHeight)
See Also:
pWidth, pHeight, User Manual

getMinimumSize

public java.awt.Dimension getMinimumSize()
Gets the minimum size in pixels of the barcode image generated.

Returns:
Dimension(8,8)
See Also:
User Manual

setForeground

public void setForeground(java.awt.Color newColor)
Sets the barColor property.

Parameters:
newColor - the new value for the barColor variable.
See Also:
barColor, User Manual

getForeground

public java.awt.Color getForeground()
Gets the barColor property.

Returns:
the current value of the barColor variable.
See Also:
barColor, User Manual

setRotationAngle

public void setRotationAngle(int newRotate)
Sets the rotate property.

Parameters:
newRotate - the new value for the rotate variable.
See Also:
rotate, User Manual

getRotationAngle

public int getRotationAngle()
Gets the rotate property.

Returns:
the current value of the rotate variable.
See Also:
rotate, User Manual

setProcessTilde

public void setProcessTilde(boolean newVal)
Sets the processTilde property.

Parameters:
newVal - the new value for the processTilde variable.
See Also:
processTilde, User Manual

setShowHR

public void setShowHR(boolean newVal)
Sets the showHR property.

Parameters:
newVal - the new value for the showHR variable.
See Also:
showHR, User Manual

getShowHR

public boolean getShowHR()
Gets the showHR property value.

Returns:
the current value of the showHR variable.
See Also:
#HR, User Manual

setSingleLineHR

public void setSingleLineHR(boolean newVal)
Sets the setSingleLineHR property.

Parameters:
newVal - the new value for the setSingleLineHR variable.
See Also:
showHR, User Manual

getSingleLineHR

public boolean getSingleLineHR()
Gets the showHR property value.

Returns:
the current value of the SingleLineHR variable.
See Also:
#HR, User Manual

setFont

public void setFont(java.awt.Font newFont)
Sets the textFont property.

Parameters:
newFont - the new value for the textFont variable.
See Also:
textFont, User Manual

getFont

public java.awt.Font getFont()
Gets the textFont property value.

Specified by:
getFont in interface java.awt.MenuContainer
Returns:
the current value of the textFont variable.
See Also:
textFont, User Manual

setTextFontColor

public void setTextFontColor(java.awt.Color newColor)
Sets the fontColor property.

Parameters:
newColor - the new value for the fontColor variable.
See Also:
fontColor, User Manual

getTextFontColor

public java.awt.Color getTextFontColor()
Gets the fontColor property value.

Returns:
the current value of the fontColor variable.
See Also:
fontColor, User Manual

getProcessTilde

public boolean getProcessTilde()
Gets the processTilde property.

Returns:
the current value of the processTilde variable.
See Also:
processTilde, User Manual

setEncodingMode

public void setEncodingMode(int newMode)
Sets the encoding property.

Parameters:
newMode - the new value for the encoding variable.
See Also:
encoding, User Manual

getEncodingMode

public int getEncodingMode()
Gets the encoding property.

Returns:
the current value of the encoding variable.
See Also:
encoding, User Manual

setPreferredFormat

public void setPreferredFormat(int newFormat)
Sets the preferredFormat property.

Parameters:
newFormat - the new value for the preferredFormat variable.
See Also:
preferredFormat, User Manual

getPreferredFormat

public int getPreferredFormat()
Gets the preferredFormat property.

Returns:
the current value of the preferredFormat variable.
See Also:
preferredFormat, User Manual

createSVG

public java.lang.String createSVG()

createEPS

public java.lang.String createEPS()

paint

public void paint(java.awt.Graphics g2)
Paints the barcode and rotates it if necessary