Package com.idautomation.datamatrix
Class DataMatrix
java.lang.Object
java.awt.Component
java.awt.Canvas
com.idautomation.datamatrix.DataMatrix
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
This is the main DataMatrix class that generates the DataMatrix barcode image.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
If true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True.Background color.Color of the modules.static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
Data to be encoded in a Data Matrix symbol.The text of the barcode after it is created.static int
static int
static int
static int
static int
static int
int
The encoding mode; valid values are E_ASCII (default), E_C40, E_TEXT or E_BASE256.The color of the humam readable text; Default=black.int
Initial preferred height property of the beandouble
The left margin of the barcode (also know as quiet zone); The default is .06 CM.double
Margin of the Barcode (also know as quiet zone).double
multiple value for width bars - should be 2.int
The preferred height of the barcode image in pixels after barcode is generated.int
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
If true, ("Y") the tilde (~) will be processed as explained in the Data Matrix user guide.int
The preferred width of the barcode image in pixels after barcode is generated.boolean
int
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
Rotation angle; valid values are 0 (default), 90, 180 & 270.boolean
If true, the human readable text will be displayed instead of the barcode Default is false.boolean
When set to True and ShowHR is True, human readable data appears on a single line.The font of the text in the barcode; Default = Arial.double
The amount of space in CM between the barcode and the human readable text.double
The top margin of the barcode (also know as quiet zone); The default is .06 CM.int
Initial preferred width property of the beandouble
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Gets the autoSize property.Gets the backColor property.Gets the code property.int
Gets the encoding property.getFont()
Gets the textFont property value.Gets the barColor property.double
Gets the leftMarginCM property.double
Gets the marginCM property.Gets the minimum size in pixels of the barcode image generated.int
Gets the resolution property.int
Gets the preferredFormat property.Gets the size in pixels of the Preferred barcode image generated.boolean
Gets the processTilde property.int
Gets the rotate property.boolean
Gets the showHR property value.boolean
Gets the showHR property value.Gets the fontColor property value.double
Gets the topMarginCM property.double
Gets the X property.void
Paints the barcode and rotates it if necessaryvoid
setAutoSize
(boolean newVal) Sets the autoSize property.void
setBackground
(Color newColor) Sets the backColor property.void
setDataToEncode
(String newCode) Sets the code property.void
setEncodingMode
(int newMode) Sets the encoding property.void
Sets the textFont property.void
setForeground
(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
(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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, 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, getMousePosition, getMouseWheelListeners, getName, getParent, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
Field Details
-
code
Data to be encoded in a Data Matrix symbol. -
mcheckdigit
-
marginCM
public double marginCMMargin of the Barcode (also know as quiet zone). The default is .06 CM -
topMarginCM
public double topMarginCMThe top margin of the barcode (also know as quiet zone); The default is .06 CM. -
leftMarginCM
public double leftMarginCMThe left margin of the barcode (also know as quiet zone); The default is .06 CM. -
backColor
Background color. -
codeText
The text of the barcode after it is created. -
resolution
public int resolutionThe 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. -
N
public double Nmultiple value for width bars - should be 2. -
X
public double XThe 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. -
width
public int widthInitial preferred width property of the bean -
height
public int heightInitial preferred height property of the bean -
pWidth
public int pWidthThe preferred width of the barcode image in pixels after barcode is generated.- See Also:
-
pHeight
public int pHeightThe preferred height of the barcode image in pixels after barcode is generated.- See Also:
-
autoSize
public boolean autoSizeIf true, will automatically size the control canvas to fit the barcode at design or runtime; Default =True. -
barColor
Color of the modules. -
rotate
public int rotateRotation angle; valid values are 0 (default), 90, 180 & 270. -
processTilde
public boolean processTildeIf 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. -
showHR
public boolean showHRIf 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 singleLineHRWhen 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
The font of the text in the barcode; Default = Arial.- See Also:
-
textMarginCM
public double textMarginCMThe 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
The color of the humam readable text; Default=black. -
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 encodingThe encoding mode; valid values are E_ASCII (default), E_C40, E_TEXT or E_BASE256. -
reBuild
public boolean reBuild -
preferredFormat
public int preferredFormatThe 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. -
C10X10
public static final int C10X10- See Also:
-
C12X12
public static final int C12X12- See Also:
-
C14X14
public static final int C14X14- See Also:
-
C16X16
public static final int C16X16- See Also:
-
C18X18
public static final int C18X18- See Also:
-
C20X20
public static final int C20X20- See Also:
-
C22X22
public static final int C22X22- See Also:
-
C24X24
public static final int C24X24- See Also:
-
C26X26
public static final int C26X26- See Also:
-
C32X32
public static final int C32X32- See Also:
-
C36X36
public static final int C36X36- See Also:
-
C40X40
public static final int C40X40- See Also:
-
C44X44
public static final int C44X44- See Also:
-
C48X48
public static final int C48X48- See Also:
-
C52X52
public static final int C52X52- See Also:
-
C64X64
public static final int C64X64- See Also:
-
C72X72
public static final int C72X72- See Also:
-
C80X80
public static final int C80X80- See Also:
-
C88X88
public static final int C88X88- See Also:
-
C96X96
public static final int C96X96- See Also:
-
C104X104
public static final int C104X104- See Also:
-
C120X120
public static final int C120X120- See Also:
-
C132X132
public static final int C132X132- See Also:
-
C144X144
public static final int C144X144- See Also:
-
C8X18
public static final int C8X18- See Also:
-
C8X32
public static final int C8X32- See Also:
-
C12X26
public static final int C12X26- See Also:
-
C12X36
public static final int C12X36- See Also:
-
C16X36
public static final int C16X36- See Also:
-
C16X48
public static final int C16X48- See Also:
-
-
Constructor Details
-
DataMatrix
public DataMatrix()
-
-
Method Details
-
setDataToEncode
Sets the code property.- Parameters:
newCode
- the new value for the code variable.- See Also:
-
getDataToEncode
Gets the code property.- Returns:
- the current value of the code variable.
- See Also:
-
setMarginCM
public void setMarginCM(double newMargin) Sets the marginCM property.- Parameters:
newMargin
- the new value for the marginCM variable.- See Also:
-
getMarginCM
public double getMarginCM()Gets the marginCM property.- Returns:
- the current value of the marginCM variable.
- See Also:
-
setTopMarginCM
public void setTopMarginCM(double newMargin) Sets the topMarginCM property.- Parameters:
newMargin
- the new value for the topMarginCM variable.- See Also:
-
getTopMarginCM
public double getTopMarginCM()Gets the topMarginCM property.- Returns:
- the current value of the topMarginCM variable.
- See Also:
-
setLeftMarginCM
public void setLeftMarginCM(double newMargin) Sets the leftMarginCM property.- Parameters:
newMargin
- the new value for the leftMarginCM variable.- See Also:
-
getLeftMarginCM
public double getLeftMarginCM()Gets the leftMarginCM property.- Returns:
- the current value of the leftMarginCM variable.
- See Also:
-
setBackground
Sets the backColor property.- Overrides:
setBackground
in classComponent
- Parameters:
newColor
- the new value for the backColor variable.- See Also:
-
getBackground
Gets the backColor property.- Overrides:
getBackground
in classComponent
- Returns:
- the current value of the backColor variable.
- See Also:
-
setPixelsPerCM
public void setPixelsPerCM(int newRes) Sets the resolution property.- Parameters:
newRes
- the new value for the resolution variable.- See Also:
-
getPixelsPerCM
public int getPixelsPerCM()Gets the resolution property.- Returns:
- the current value of the resolution variable.
- See Also:
-
setXDimensionCM
public void setXDimensionCM(double newX) Sets the X property.- Parameters:
newX
- the new value for the X variable.- See Also:
-
getXDimensionCM
public double getXDimensionCM()Gets the X property.- Returns:
- the current value of the X variable.
- See Also:
-
setAutoSize
public void setAutoSize(boolean newVal) Sets the autoSize property.- Parameters:
newVal
- the new value for the autoSize variable.- See Also:
-
getAutoSize
public boolean getAutoSize()Gets the autoSize property.- Returns:
- the current value of the autoSize variable.
- See Also:
-
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:
-
getPreferredSize
Gets the size in pixels of the Preferred barcode image generated.- Overrides:
getPreferredSize
in classComponent
- Returns:
- Dimension(pWidth,pHeight)
- See Also:
-
getMinimumSize
Gets the minimum size in pixels of the barcode image generated.- Overrides:
getMinimumSize
in classComponent
- Returns:
- Dimension(8,8)
- See Also:
-
setForeground
Sets the barColor property.- Overrides:
setForeground
in classComponent
- Parameters:
newColor
- the new value for the barColor variable.- See Also:
-
getForeground
Gets the barColor property.- Overrides:
getForeground
in classComponent
- Returns:
- the current value of the barColor variable.
- See Also:
-
setRotationAngle
public void setRotationAngle(int newRotate) Sets the rotate property.- Parameters:
newRotate
- the new value for the rotate variable.- See Also:
-
getRotationAngle
public int getRotationAngle()Gets the rotate property.- Returns:
- the current value of the rotate variable.
- See Also:
-
setProcessTilde
public void setProcessTilde(boolean newVal) Sets the processTilde property.- Parameters:
newVal
- the new value for the processTilde variable.- See Also:
-
setShowHR
public void setShowHR(boolean newVal) Sets the showHR property.- Parameters:
newVal
- the new value for the showHR variable.- See Also:
-
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:
-
getSingleLineHR
public boolean getSingleLineHR()Gets the showHR property value.- Returns:
- the current value of the SingleLineHR variable.
- See Also:
-
#HR
- User Manual
-
setFont
Sets the textFont property. -
getFont
Gets the textFont property value.- Specified by:
getFont
in interfaceMenuContainer
- Overrides:
getFont
in classComponent
- Returns:
- the current value of the textFont variable.
- See Also:
-
setTextFontColor
Sets the fontColor property.- Parameters:
newColor
- the new value for the fontColor variable.- See Also:
-
getTextFontColor
Gets the fontColor property value.- Returns:
- the current value of the fontColor variable.
- See Also:
-
getProcessTilde
public boolean getProcessTilde()Gets the processTilde property.- Returns:
- the current value of the processTilde variable.
- See Also:
-
setEncodingMode
public void setEncodingMode(int newMode) Sets the encoding property.- Parameters:
newMode
- the new value for the encoding variable.- See Also:
-
getEncodingMode
public int getEncodingMode()Gets the encoding property.- Returns:
- the current value of the encoding variable.
- See Also:
-
setPreferredFormat
public void setPreferredFormat(int newFormat) Sets the preferredFormat property.- Parameters:
newFormat
- the new value for the preferredFormat variable.- See Also:
-
getPreferredFormat
public int getPreferredFormat()Gets the preferredFormat property.- Returns:
- the current value of the preferredFormat variable.
- See Also:
-
createSVG
-
createEPS
-
paint
Paints the barcode and rotates it if necessary
-