Package com.idautomation.maxicode
Class MaxiCode
java.lang.Object
java.awt.Component
java.awt.Canvas
com.idautomation.maxicode.MaxiCode
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
This class paints a maxicode symbol.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean
If true, the image will be resized to fit the size available for the component.Background color.Color of the MaxiCode pattern.Country code (modes 2 and 3)Data to be encoded.double
Length in millimeters of the symbol, default = 25.5 mm.int
Maxicode mode: Values range from 2 to 6; default=2 for US; 3 = International and 4 = standard (non-shipping) symbols.int
Number of symbol in structured appended modeint
paint the symbol at these coordinatesint
paint the symbol at these coordinatesint
Position of this symbol in the sequence of the structured appended.boolean
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 of the printer in dpi, Default is 200.int
Rotation angle.Service class (modes 2 and 3).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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[][]
creates a hexagon pattern, if a standard cannot be used.boolean
Gets the autoResize property.Gets the backColor property.Gets the country property.getData()
Gets the dataStr property.Gets the color property value.int
Height of hexagon modules (pixels)int
getMode()
Gets the mode property.getName()
Returns "MaxiCode".int
Gets the numberOfCodes property.int
Gets the positionOfCode property.Returns size needed to draw the symbol.boolean
Gets the processTilde property.int
Gets the resolution property.int
Gets the rotation property.Gets the serviceClass property.int
Width of hexagon modules (pixels)Gets the zipCode property.void
paints the maxicode symbol.void
setAutoResize
(boolean b) Sets the autoResize property.void
setBackground
(Color newColor) Sets the backColor property.void
setCountry
(String c) Sets the country property.void
Sets the dataStr property.void
setForeground
(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 calledboolean
setResolution
(int r) Sets the resolution property.void
setRotation
(int r) Sets the rotation property.void
Sets the serviceClass property.void
setZipCode
(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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBaseline, getBaselineResizeBehavior, 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, getMousePosition, getMouseWheelListeners, 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, setFont, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
Field Details
-
color
Color of the MaxiCode pattern. -
backColor
Background color. -
L
public double LLength in millimeters of the symbol, default = 25.5 mm.- See Also:
-
resolution
public int resolutionResolution of the printer in dpi, Default is 200.- See Also:
-
offsetX
public int offsetXpaint the symbol at these coordinates -
offsetY
public int offsetYpaint the symbol at these coordinates -
processTilde
public boolean processTildeIf true, three numbers after the Tilde will insert an ASCII code; For example ~009 will insert ASCII 9 into the data string. -
mode
public int modeMaxicode mode: Values range from 2 to 6; default=2 for US; 3 = International and 4 = standard (non-shipping) symbols.- See Also:
-
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:
-
serviceClass
Service class (modes 2 and 3). -
country
Country code (modes 2 and 3)- See Also:
-
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:
-
numberOfCodes
public int numberOfCodesNumber of symbol in structured appended mode -
positionOfCode
public int positionOfCodePosition of this symbol in the sequence of the structured appended. -
rotation
public int rotationRotation angle. It can be 0,90,180 or 270- See Also:
-
autoResize
public boolean autoResizeIf true, the image will be resized to fit the size available for the component. This is used to show the symbol on the screen.
-
-
Constructor Details
-
MaxiCode
public MaxiCode()Constructor
-
-
Method Details
-
setForeground
Sets the color property.- Overrides:
setForeground
in classComponent
- Parameters:
newColor
- the new value for the color variable.- See Also:
-
getForeground
Gets the color property value.- Overrides:
getForeground
in classComponent
- Returns:
- the current value of the color 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:
-
setL
public boolean setL(double l) Sets the L property.- Parameters:
l
- the new value for the L variable.- See Also:
-
setResolution
public boolean setResolution(int r) Sets the resolution property.- Parameters:
r
- the new value for the resolution variable.- See Also:
-
getResolution
public int getResolution()Gets the resolution property.- Returns:
- the current value of the resolution variable.
- See Also:
-
setProcessTilde
public void setProcessTilde(boolean pt) Sets the processTilde property.- Parameters:
pt
- the new value for the processTilde variable.- See Also:
-
getProcessTilde
public boolean getProcessTilde()Gets the processTilde property.- Returns:
- the current string value of th processTildee variable.
- See Also:
-
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
Returns "MaxiCode". -
getWHexagon
public int getWHexagon()Width of hexagon modules (pixels)- See Also:
-
getHHexagon
public int getHHexagon()Height of hexagon modules (pixels)- See Also:
-
setMode
public void setMode(int m) Sets the mode property.- Parameters:
m
- the new value for the mode variable.- See Also:
-
getMode
public int getMode()Gets the mode property.- Returns:
- the current value of the mode variable.
- See Also:
-
setZipCode
Sets the zipCode property.- Parameters:
zp
- the new value for the zipCode variable.- See Also:
-
getZipCode
Gets the zipCode property.- Returns:
- the current value of the zipCode variable.
- See Also:
-
setServiceClass
Sets the serviceClass property.- Parameters:
s
- the new value for the serviceClass variable.- See Also:
-
getServiceClass
Gets the serviceClass property.- Returns:
- the current value of the serviceClass variable.
- See Also:
-
setCountry
Sets the country property.- Parameters:
c
- the new value for the country variable.- See Also:
-
getCountry
Gets the country property.- Returns:
- the current value of the country variable.
- See Also:
-
setData
Sets the dataStr property.- Parameters:
d
- the new value for the dataStr variable.- See Also:
-
getData
Gets the dataStr property.- Returns:
- the current value of the dataStr variable.
- See Also:
-
setNumberOfCodes
public void setNumberOfCodes(int n) Sets the numberOfCodes property.- Parameters:
n
- the new value for the numberOfCodes variable.- See Also:
-
getNumberOfCodes
public int getNumberOfCodes()Gets the numberOfCodes property.- Returns:
- the current value of the numberOfCodes variable.
- See Also:
-
setPositionOfCode
public void setPositionOfCode(int n) Sets the positionOfCode property.- Parameters:
n
- the new value for the positionOfCode variable.- See Also:
-
getPositionOfCode
public int getPositionOfCode()Gets the positionOfCode property.- Returns:
- the current value of the positionOfCode variable.
- See Also:
-
setRotation
public void setRotation(int r) Sets the rotation property.- Parameters:
r
- the new value for the rotation variable.- See Also:
-
getRotation
public int getRotation()Gets the rotation property.- Returns:
- the current value of the rotation variable.
- See Also:
-
getPreferredSize
Returns size needed to draw the symbol.- Overrides:
getPreferredSize
in classComponent
- See Also:
-
setAutoResize
public void setAutoResize(boolean b) Sets the autoResize property.- Parameters:
b
- the new value for the autoResize variable.- See Also:
-
getAutoResize
public boolean getAutoResize()Gets the autoResize property.- Returns:
- the current value of the autoResize 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:
-
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
paints the maxicode symbol.
-