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
- backColor
. Symbol's backgound color.
-
- color
. Symbols's foregorund color.
-
- L
- Length in mm of the symbol. The default is 25.5
- offsetX
- paint the symbol at these coordinates. The default is 0.
- offsetY
- paint the symbol at these coordinates. The default is 0.
-
RMaxiCode()
- Constructor
-
- 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.
- getCountry()
- country code (modes 2 and 3)
- getData()
- data to be encoded.
- getHHexagon()
- Height of hexagon modules (pixels)
- getMode()
- maxicode mode.
- getName()
- Returns "RMaxiCode".
- getNumberOfCodes()
- number of symbol in structured appended mode
- getPositionOfCode()
- number of symbol in structured appended mode
- getPreferredSize()
- returns size needed to draw the symbol
- getResolution()
- Get current resolution of the printer (in dpi)
- getRotation()
- rotation angle. Can be 0, 90,180 or 270.
- getServiceClass()
- service class (modes 2 and 3).
- getWHexagon()
- width of hexagon modules (pixels)
- getZipCode()
- postal code (modes 2 and 3)
- paint(Graphics)
- paints the maxicode symbol.
- setAutoResize(boolean)
- if true the image will be resized to fit the size available for the component.
- setCountry(String)
- country code (modes 2 and 3) . A 3 -digit number.
- setData(String)
- data to be encoded.
-
- setHexagonPattern(int[][])
- set a user defined pattern for the hexagons.
- setL(double)
- Set length of length symbol.
- setMode(int)
- maxicode mode.
- setNumberOfCodes(int)
- number of symbol in structured appended mode.
- setPositionOfCode(int)
- number of symbol in structured appended mode .
- setRedraw(boolean)
- force recalculating the symbol next time paint() is called
- setResolution(int)
- Set resolution of the printer (in dpi).
- setRotation(int)
- rotation angle. Can be 0, 90,180 or 270.
- setServiceClass(String)
- service class (modes 2 and 3). A 3 -digit number.
- setZipCode(String)
- postal code (modes 2 and 3) . A 9 -digit number in mode 2 and a 5 alphanumeric
string in mode 3.
color
public Color color
backColor
public 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
RMaxiCode
public RMaxiCode()
- Constructor
getAutoResize
public boolean getAutoResize()
- if true the image will be resized to fit the size of the barcode
getCountry
public String getCountry()
- country code (modes 2 and 3)
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)
getHHexagon
public int getHHexagon()
- Height of hexagon modules (pixels)
getMode
public int getMode()
- maxicode mode. Values range from 2 to 6
getName
public String getName()
- Returns "RMaxiCode".
- Overrides:
- getName in class Component
getNumberOfCodes
public int getNumberOfCodes()
- number of symbol in structured appended mode
getPositionOfCode
public int getPositionOfCode()
- number of symbol in structured appended mode
getPreferredSize
public Dimension getPreferredSize()
- returns size needed to draw the symbol. Will depens on L and the resolution.
- Overrides:
- getPreferredSize in class Component
getResolution
public int getResolution()
- Get current resolution of the printer (in dpi)
getRotation
public int getRotation()
- rotation angle. It can be 0,90,180 or 270
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.
getWHexagon
public int getWHexagon()
- width of hexagon modules (pixels)
getZipCode
public String getZipCode()
- postal code (modes 2 and 3)
paint
public void paint(Graphics g)
- paints the maxicode symbol.
- Overrides:
- paint in class Canvas
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.
setCountry
public void setCountry(String c)
- country code (modes 2 and 3)
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.....
-
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.
setL
public boolean setL(double l)
- Set length of length symbol. The default is 25.5 millimeters.
setMode
public void setMode(int m)
- maxicode mode. Values range from 2 to 6
setNumberOfCodes
public void setNumberOfCodes(int n)
- number of symbol in structured appended mode
setPositionOfCode
public void setPositionOfCode(int n)
- number of symbol in structured appended mode
setRedraw
public void setRedraw(boolean b)
- force recalculating the symbol next time paint() is called
setResolution
public boolean setResolution(int r)
- Set resolution of the printer (in dpi). The default is 200 dpi.
setRotation
public void setRotation(int r)
- rotation angle. It can be 0,90,180 or 270
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.
setZipCode
public void setZipCode(String zp)
- postal code (modes 2 and 3)