com.idautomation.maxicode
Class MaxiCode

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

public class MaxiCode
extends java.awt.Canvas

This class paints a maxicode symbol.

See Also:
Serialized Form

Field Summary
 boolean autoResize
          If true, the image will be resized to fit the size available for the component.
 java.awt.Color backColor
          Background color.
 java.awt.Color color
          Color of the MaxiCode pattern.
 java.lang.String country
          Country code (modes 2 and 3)
 java.lang.String dataStr
          Data to be encoded.
 double L
          Length in millimeters of the symbol, default = 25.5 mm.
 int mode
          Maxicode mode: Values range from 2 to 6; default=2 for US; 3 = International and 4 = standard (non-shipping) symbols.
 int numberOfCodes
          Number of symbol in structured appended mode
 int offsetX
          paint the symbol at these coordinates
 int offsetY
          paint the symbol at these coordinates
 int positionOfCode
          Position of this symbol in the sequence of the structured appended.
 boolean processTilde
          If true, three numbers after the Tilde will insert an ASCII code; For example ~009 will insert ASCII 9 into the data string.
 int resolution
          Resolution of the printer in dpi, Default is 200.
 int rotation
          Rotation angle.
 java.lang.String serviceClass
          Service class (modes 2 and 3).
 java.lang.String zipCode
          Postal code (modes 2 and 3) In mode 3 it can be an alphanumeric of length 5.
 
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
MaxiCode()
          Constructor
 
Method Summary
 int[][] createPattern()
          creates a hexagon pattern, if a standard cannot be used.
 boolean getAutoResize()
          Gets the autoResize property.
 java.awt.Color getBackground()
          Gets the backColor property.
 java.lang.String getCountry()
          Gets the country property.
 java.lang.String getData()
          Gets the dataStr property.
 java.awt.Color getForeground()
          Gets the color property value.
 int getHHexagon()
          Height of hexagon modules (pixels)
 int getMode()
          Gets the mode property.
 java.lang.String getName()
          Returns "MaxiCode".
 int getNumberOfCodes()
          Gets the numberOfCodes property.
 int getPositionOfCode()
          Gets the positionOfCode property.
 java.awt.Dimension getPreferredSize()
          Returns size needed to draw the symbol.
 boolean getProcessTilde()
          Gets the processTilde property.
 int getResolution()
          Gets the resolution property.
 int getRotation()
          Gets the rotation property.
 java.lang.String getServiceClass()
          Gets the serviceClass property.
 int getWHexagon()
          Width of hexagon modules (pixels)
 java.lang.String getZipCode()
          Gets the zipCode property.
 void paint(java.awt.Graphics g)
          paints the maxicode symbol.
 void setAutoResize(boolean b)
          Sets the autoResize property.
 void setBackground(java.awt.Color newColor)
          Sets the backColor property.
 void setCountry(java.lang.String c)
          Sets the country property.
 void setData(java.lang.String d)
          Sets the dataStr property.
 void setForeground(java.awt.Color newColor)
          Sets the color property.
 void setHexagonPattern(int[][] p)
          set a user defined pattern for the hexagons.
 void setImageSize(int imgWidth, int imgHeight)
          Sets the size of the generated image, if used then autoSize is set to false.
 boolean setL(double l)
          Sets the L property.
 void setMode(int m)
          Sets the mode property.
 void setNumberOfCodes(int n)
          Sets the numberOfCodes property.
 void setPositionOfCode(int n)
          Sets the positionOfCode property.
 void setProcessTilde(boolean pt)
          Sets the processTilde property.
 void setRedraw(boolean b)
          Force recalculating the symbol next time paint() is called
 boolean setResolution(int r)
          Sets the resolution property.
 void setRotation(int r)
          Sets the rotation property.
 void setServiceClass(java.lang.String s)
          Sets the serviceClass property.
 void setZipCode(java.lang.String zp)
          Sets the zipCode 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, getFont, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, 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, setFont, 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

color

public java.awt.Color color
Color of the MaxiCode pattern.

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

backColor

public java.awt.Color backColor
Background color.

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

L

public double L
Length in millimeters of the symbol, default = 25.5 mm.

See Also:
setL(double l), User Manual

resolution

public int resolution
Resolution of the printer in dpi, Default is 200.

See Also:
setResolution(int r), getResolution(), User Manual

offsetX

public int offsetX
paint the symbol at these coordinates


offsetY

public int offsetY
paint the symbol at these coordinates


processTilde

public boolean processTilde
If true, three numbers after the Tilde will insert an ASCII code; For example ~009 will insert ASCII 9 into the data string.

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

mode

public int mode
Maxicode mode: Values range from 2 to 6; default=2 for US; 3 = International and 4 = standard (non-shipping) symbols.

See Also:
setMode(int m), getMode(), User Manual

zipCode

public java.lang.String zipCode
Postal code (modes 2 and 3) In mode 3 it can be an alphanumeric of length 5. In mode 2 can be a numeric of length 9.

See Also:
setZipCode(String zp), getZipCode(), User Manual

serviceClass

public java.lang.String serviceClass
Service class (modes 2 and 3).

See Also:
setServiceClass(String s), getServiceClass(), User Manual

country

public java.lang.String country
Country code (modes 2 and 3)

See Also:
setCountry(String c), getCountry(), User Manual

dataStr

public java.lang.String dataStr
Data to be encoded. In modes 2 and 3 if the postal code is empty it will be extracted from the beginning of this string (see maxicode specifications)

See Also:
setData(String d), getData(), User Manual

numberOfCodes

public int numberOfCodes
Number of symbol in structured appended mode

See Also:
setNumberOfCodes(int n), getNumberOfCodes(), User Manual

positionOfCode

public int positionOfCode
Position of this symbol in the sequence of the structured appended.

See Also:
setPositionOfCode(int n), getPositionOfCode(), User Manual

rotation

public int rotation
Rotation angle. It can be 0,90,180 or 270

See Also:
setRotation(int r), getRotation(), User Manual

autoResize

public boolean autoResize
If true, the image will be resized to fit the size available for the component. This is used to show the symbol on the screen.

See Also:
setAutoResize(boolean b), getAutoResize(), User Manual
Constructor Detail

MaxiCode

public MaxiCode()
Constructor

Method Detail

setForeground

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

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

getForeground

public java.awt.Color getForeground()
Gets the color property value.

Returns:
the current value of the color variable.
See Also:
color, 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

setL

public boolean setL(double l)
Sets the L property.

Parameters:
l - the new value for the L variable.
See Also:
L, User Manual

setResolution

public boolean setResolution(int r)
Sets the resolution property.

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

getResolution

public int getResolution()
Gets the resolution property.

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

setProcessTilde

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

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

getProcessTilde

public boolean getProcessTilde()
Gets the processTilde property.

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

setHexagonPattern

public void setHexagonPattern(int[][] p)
set a user defined pattern for the hexagons. For example: int[ ][ ] pattern = { {0,0,0,0,0,0,0}, {0,0,0,1,1,0,0}, {0,0,1,1,1,1,0}, {0,1,1,1,1,1,1}, {0,1,1,1,1,1,1}, {0,1,1,1,1,1,1}, {0,0,1,1,1,1,0}, {0,0,0,1,1,0,0}, }; myMaxicode.setPattern(pattern);


getName

public java.lang.String getName()
Returns "MaxiCode".


getWHexagon

public int getWHexagon()
Width of hexagon modules (pixels)

See Also:
getHHexagon(), User Manual

getHHexagon

public int getHHexagon()
Height of hexagon modules (pixels)

See Also:
getWHexagon(), User Manual

setMode

public void setMode(int m)
Sets the mode property.

Parameters:
m - the new value for the mode variable.
See Also:
mode, User Manual

getMode

public int getMode()
Gets the mode property.

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

setZipCode

public void setZipCode(java.lang.String zp)
Sets the zipCode property.

Parameters:
zp - the new value for the zipCode variable.
See Also:
zipCode, User Manual

getZipCode

public java.lang.String getZipCode()
Gets the zipCode property.

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

setServiceClass

public void setServiceClass(java.lang.String s)
Sets the serviceClass property.

Parameters:
s - the new value for the serviceClass variable.
See Also:
serviceClass, User Manual

getServiceClass

public java.lang.String getServiceClass()
Gets the serviceClass property.

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

setCountry

public void setCountry(java.lang.String c)
Sets the country property.

Parameters:
c - the new value for the country variable.
See Also:
country, User Manual

getCountry

public java.lang.String getCountry()
Gets the country property.

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

setData

public void setData(java.lang.String d)
Sets the dataStr property.

Parameters:
d - the new value for the dataStr variable.
See Also:
dataStr, User Manual

getData

public java.lang.String getData()
Gets the dataStr property.

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

setNumberOfCodes

public void setNumberOfCodes(int n)
Sets the numberOfCodes property.

Parameters:
n - the new value for the numberOfCodes variable.
See Also:
numberOfCodes, User Manual

getNumberOfCodes

public int getNumberOfCodes()
Gets the numberOfCodes property.

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

setPositionOfCode

public void setPositionOfCode(int n)
Sets the positionOfCode property.

Parameters:
n - the new value for the positionOfCode variable.
See Also:
positionOfCode, User Manual

getPositionOfCode

public int getPositionOfCode()
Gets the positionOfCode property.

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

setRotation

public void setRotation(int r)
Sets the rotation property.

Parameters:
r - the new value for the rotation variable.
See Also:
rotation, User Manual

getRotation

public int getRotation()
Gets the rotation property.

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

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns size needed to draw the symbol.

See Also:
User Manual

setAutoResize

public void setAutoResize(boolean b)
Sets the autoResize property.

Parameters:
b - the new value for the autoResize variable.
See Also:
autoResize, User Manual

getAutoResize

public boolean getAutoResize()
Gets the autoResize property.

Returns:
the current value of the autoResize variable.
See Also:
autoResize, 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

createPattern

public int[][] createPattern()
creates a hexagon pattern, if a standard cannot be used.


setRedraw

public void setRedraw(boolean b)
Force recalculating the symbol next time paint() is called


paint

public void paint(java.awt.Graphics g)
paints the maxicode symbol.