Class com.java4less.rmaxicode.RMaxiCode

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----com.java4less.rmaxicode.RMaxiCode

public class RMaxiCode
extends Canvas

this class paints a maxicode barcode. The following is an example:

RMaxiCode rm=new RMaxiCode();

rm.setData("This is a test"); // set the data to encode

rm.setMode(4); // set the mode

myPanel.add(rm); // add the maxicode to your panel

 


Variable Index

 o backColor . Symbol's backgound color.
 o color . Symbols's foregorund color.
 o L
Length in mm of the symbol. The default is 25.5
 o offsetX
paint the symbol at these coordinates. The default is 0.
 o offsetY
paint the symbol at these coordinates. The default is 0.

Constructor Index

 o RMaxiCode()
Constructor

Method Index

 
 o getAutoResize()
if true the image will be resized to fit the size of the barcode . Use this only to draw the maxicode on the screen.
 o getCountry()
country code (modes 2 and 3)
 o getData()
data to be encoded.
 o getHHexagon()
Height of hexagon modules (pixels)
 o getMode()
maxicode mode.
 o getName()
Returns "RMaxiCode".
 o getNumberOfCodes()
number of symbol in structured appended mode
 o getPositionOfCode()
number of symbol in structured appended mode
 o getPreferredSize()
returns size needed to draw the symbol
 o getResolution()
Get current resolution of the printer (in dpi)
 o getRotation()
rotation angle. Can be 0, 90,180 or 270.
 o getServiceClass()
service class (modes 2 and 3).
 o getWHexagon()
width of hexagon modules (pixels)
 o getZipCode()
postal code (modes 2 and 3)
 o paint(Graphics)
paints the maxicode symbol.
 o setAutoResize(boolean)
if true the image will be resized to fit the size available for the component.
 o setCountry(String)
country code (modes 2 and 3) . A 3 -digit number.
 o setData(String)
data to be encoded.
 
 o setHexagonPattern(int[][])
set a user defined pattern for the hexagons.
 o setL(double)
Set length of length symbol.
 o setMode(int)
maxicode mode.
 o setNumberOfCodes(int)
number of symbol in structured appended mode.
 o setPositionOfCode(int)
number of symbol in structured appended mode .
 o setRedraw(boolean)
force recalculating the symbol next time paint() is called
 o setResolution(int)
Set resolution of the printer (in dpi).
 o setRotation(int)
rotation angle. Can be 0, 90,180 or 270.
 o setServiceClass(String)
service class (modes 2 and 3). A 3 -digit number.
 o setZipCode(String)
postal code (modes 2 and 3) . A 9 -digit number in mode 2 and a 5 alphanumeric string in mode 3.

Variables

 o color
 public Color color
 o backColor
 public Color backColor
 o L
 public double L
Length in mm of the symbol

 o offsetX
 public int offsetX
paint the symbol at these coordinates

 o offsetY
 public int offsetY
paint the symbol at these coordinates

Constructors

 o RMaxiCode
 public RMaxiCode()
Constructor

Methods

 o getAutoResize

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

 o getCountry
 public String getCountry()
country code (modes 2 and 3)

 o getData
 public 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)

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

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

 o getName
 public String getName()
Returns "RMaxiCode".

Overrides:
getName in class Component
 o getNumberOfCodes
 public int getNumberOfCodes()
number of symbol in structured appended mode

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

 o getPreferredSize
 public Dimension getPreferredSize()
returns size needed to draw the symbol. Will depens on L and the resolution.

Overrides:
getPreferredSize in class Component
 o getResolution
 public int getResolution()
Get current resolution of the printer (in dpi)

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

 o getServiceClass
 public 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.

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

 o getZipCode
 public String getZipCode()
postal code (modes 2 and 3)

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

Overrides:
paint in class Canvas
 o 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.

 o setCountry
 public void setCountry(String c)
country code (modes 2 and 3)

 o setData
 public void setData(String d)
data to be encoded. If the postal code, service class and country are left empyt in mode 2 and 3, they will be extracted from this string as follows:
1. If the string begins by [)>RS01GS the following format is expected: [)>RS01GSPostalCodeGSCountryGSServiceGSdata..... where RS is character number 30 and GS is character number 29
2. otherwise the format must be: PostalCodeGSCountryGSServiceGSdata.....

 o setHexagonPattern
 public void setHexagonPattern(int p[][])
set a user defined pattern for the hexagons. For example, in a resolution of 8 dots per millimeter:
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);
 

you can uset getHHexagon() and gwtWHexagon to find out the size of the pattern in pixels.

 

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

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

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

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

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

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

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

 o setServiceClass
 public void setServiceClass(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.

 o setZipCode
 public void setZipCode(String zp)
postal code (modes 2 and 3)