com.java4less.rmaxicode
Class RMaxiCode

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by com.java4less.rmaxicode.RMaxiCode
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class RMaxiCode
extends java.awt.Canvas

this class paints a maxicode barcode

See Also:
Serialized Form

Field Summary
 java.awt.Color backColor
           
 java.awt.Color color
           
 double L
          Length in mm of the symbol
 int offsetX
          paint the symbol at these coordinates
 int offsetY
          paint the symbol at these coordinates
 
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
RMaxiCode()
          Constructor
 
Method Summary
 int[][] createPattern()
          creates a hexagon pattern, if a standard cannot be used.
 boolean getAutoResize()
          if true the image will be resized to fit the size of the barcode
 java.lang.String getCountry()
          country code (modes 2 and 3)
 int getCurrentX()
           
 int getCurrentY()
           
 java.lang.String getData()
          data to be encoded.
 int getHHexagon()
          Height of hexagon modules (pixels)
 int getMode()
          maxicode mode.
 java.lang.String getName()
          Returns "RMaxiCode".
 int getNumberOfCodes()
          number of symbol in structured appended mode
 int getPositionOfCode()
          number of symbol in structured appended mode
 java.awt.Dimension getPreferredSize()
          returns size needed to draw the symbol
 boolean getProcessTilde()
           
 int getResolution()
          Get current resolution of the printer (in dpi)
 int getRotation()
          rotation angle.
 java.lang.String getServiceClass()
          service class (modes 2 and 3).
 int getWHexagon()
          width of hexagon modules (pixels)
 java.lang.String getZipCode()
          postal code (modes 2 and 3)
 void paint(java.awt.Graphics g)
          paints the maxicode symbol.
 void setAutoResize(boolean b)
          if true the image will be resized to fit the size available for the component.
 void setCountry(java.lang.String c)
          country code (modes 2 and 3)
 void setCurrentX(int currentX)
           
 void setCurrentY(int currentY)
           
 void setData(java.lang.String d)
          data to be encoded.
 void setHexagonPattern(int[][] p)
          set a user defined pattern for the hexagons.
 boolean setL(double l)
          Set length of length symbol.
 void setMode(int m)
          maxicode mode.
 void setNumberOfCodes(int n)
          number of symbol in structured appended mode
 void setPositionOfCode(int n)
          number of symbol in structured appended mode
 void setProcessTilde(boolean pt)
           
 void setRedraw(boolean b)
          force recalculating the symbol next time paint() is called
 boolean setResolution(int r)
          Set resolution of the printer (in dpi).
 void setRotation(int r)
          rotation angle.
 void setServiceClass(java.lang.String s)
          service class (modes 2 and 3).
 void setZipCode(java.lang.String zp)
          postal code (modes 2 and 3)
 
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, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, 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, 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, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, 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

backColor

public java.awt.Color backColor

L

public double L
Length in mm of the symbol


offsetX

public int offsetX
paint the symbol at these coordinates


offsetY

public int offsetY
paint the symbol at these coordinates

Constructor Detail

RMaxiCode

public RMaxiCode()
Constructor

Method Detail

getProcessTilde

public boolean getProcessTilde()

setProcessTilde

public void setProcessTilde(boolean pt)

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 "RMaxiCode".

Overrides:
getName in class java.awt.Component

getWHexagon

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


getHHexagon

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


setMode

public void setMode(int m)
maxicode mode. Values range from 2 to 6


getMode

public int getMode()
maxicode mode. Values range from 2 to 6


getZipCode

public java.lang.String getZipCode()
postal code (modes 2 and 3)


setZipCode

public void setZipCode(java.lang.String zp)
postal code (modes 2 and 3)


getServiceClass

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


setServiceClass

public void setServiceClass(java.lang.String s)
service class (modes 2 and 3). In mode 2 it can be an alphanumeric of length 5. In mode 3 can be a numeric of length 9.


getCountry

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


setCountry

public void setCountry(java.lang.String c)
country code (modes 2 and 3)


getData

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


setData

public void setData(java.lang.String d)
data to be encoded. In modes 2 and 3 if the postal code is empty it will be extracted from the begining of this string (see maxicode specifications)


getNumberOfCodes

public int getNumberOfCodes()
number of symbol in structured appended mode


setNumberOfCodes

public void setNumberOfCodes(int n)
number of symbol in structured appended mode


getPositionOfCode

public int getPositionOfCode()
number of symbol in structured appended mode


setPositionOfCode

public void setPositionOfCode(int n)
number of symbol in structured appended mode


getRotation

public int getRotation()
rotation angle. It can be 0,90,180 or 270


setRotation

public void setRotation(int r)
rotation angle. It can be 0,90,180 or 270


getPreferredSize

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

Overrides:
getPreferredSize in class java.awt.Component

setAutoResize

public void setAutoResize(boolean b)
if true the image will be resized to fit the size available for the component. Thi is used to show the symbol on the screen.


getAutoResize

public boolean getAutoResize()
if true the image will be resized to fit the size of the barcode


setResolution

public boolean setResolution(int r)
Set resolution of the printer (in dpi). The default is 200 dpi.


getResolution

public int getResolution()
Get current resolution of the printer (in dpi)


setL

public boolean setL(double l)
Set length of length symbol. The default is 25.5 millimeters.


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.

Overrides:
paint in class java.awt.Canvas

getCurrentX

public int getCurrentX()

setCurrentX

public void setCurrentX(int currentX)

getCurrentY

public int getCurrentY()

setCurrentY

public void setCurrentY(int currentY)