com.java4less.raztec
Class AztecCode

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

public class AztecCode
extends java.awt.Canvas

This class creates Aztec Code symbols. Since it is a subclass of java.awt.Canvas it can be added to any Java container.
Image files can be created with the following code:

AztecCode barcode=new AztecCode();
barcode.setCode("ABC");
barcode.setSize(300,300);
com.java4less.encoder.ImageEncoder be= new com.java4less.encoder.ImageEncoder(barcode,"JPEG","barcode.jpg");


If you want to create gif or png files you will need to download the encoders:
- gif encoder from http://www.acme.com/resources/classes/Acme.tar.gz
- png encoder http://users.boone.net/wbrameld/pngencoder


The barcode can also be painted in a external graphic context, for example an image:

java.awt.image.BufferedImage im=new java.awt.image.BufferedImage(barcode.getWidth(),barcode.getHeight(),java.awt.image.BufferedImage.TYPE_INT_RGB);
Graphics g2=im.createGraphics();
barcode.paint(g2);

See Also:
Serialized Form

Field Summary
static int CONFIGURATION_101X101
           
static int CONFIGURATION_105X105
           
static int CONFIGURATION_109X109
           
static int CONFIGURATION_113X113
           
static int CONFIGURATION_117X117
           
static int CONFIGURATION_121X121
           
static int CONFIGURATION_125X125
           
static int CONFIGURATION_131X131
           
static int CONFIGURATION_135X135
           
static int CONFIGURATION_139X139
           
static int CONFIGURATION_143X143
           
static int CONFIGURATION_147X147
           
static int CONFIGURATION_151X151
           
static int CONFIGURATION_15X15_COMPACT
          available configurations
static int CONFIGURATION_19X19
           
static int CONFIGURATION_19X19_COMPACT
           
static int CONFIGURATION_23X23
           
static int CONFIGURATION_23X23_COMPACT
           
static int CONFIGURATION_27X27
           
static int CONFIGURATION_27X27_COMPACT
           
static int CONFIGURATION_31X31
           
static int CONFIGURATION_37X37
           
static int CONFIGURATION_41X41
           
static int CONFIGURATION_45X45
           
static int CONFIGURATION_49X49
           
static int CONFIGURATION_53X53
           
static int CONFIGURATION_57X57
           
static int CONFIGURATION_61X61
           
static int CONFIGURATION_67X67
           
static int CONFIGURATION_71X71
           
static int CONFIGURATION_75X75
           
static int CONFIGURATION_79X79
           
static int CONFIGURATION_83X83
           
static int CONFIGURATION_87X87
           
static int CONFIGURATION_91X91
           
static int CONFIGURATION_95X95
           
static int CONFIGURATION_ANY
          types of configurations
static int CONFIGURATION_COMPACT
           
static int CONFIGURATION_FULL
           
static int ENC_BINARY
           
static int ENC_NORMAL
           
 
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
AztecCode()
           
 
Method Summary
 boolean getAutoConfigurate()
          allow automatic selection of a larger configuration (than the preferred) if code is too large.
 java.awt.Color getbackColor()
          background color.
 java.awt.Color getbarColor()
          color of the bars.
 java.lang.String getCode()
          text to be painted as barcode.
 int[] getCodeBinary()
          bytes to be painted as barcode.
 int getConfigurationType()
          use this property to define which formats can be used: CONFIGURATION_ANY (any), CONFIGURATION_COMPACT (only compact formats) or CONFIGURATION_FULL (only full range formats).
 int getCurrentX()
          get last X possition.
 int getCurrentY()
          get last Y possition.
 int getEncoding()
          Encoding, NORMAL or BINARY
 int getErrorCorrectionLevel()
          Error correction level (5% to 95%).
 java.lang.String getFileId()
          file id in structured append
 int getMargin()
          margin of the barcode (also know as quite zone).
 double getModuleSize()
          size (width) of the bars (module).
 java.lang.String getName()
          Returns "RAztecCode".
 int getPreferredConfiguration()
          use this configuration if possible
 boolean getProcessTilde()
          process tilde.
 boolean getReaderInitilization()
          activate reader initialization bit
 boolean getRedraw()
          Redraw symbol
 int getRune()
          Aztec rune's.
 boolean getStructuredAppend()
          activate structured append
 int getStructuredAppendCounter()
          number of symbols in structured append (value 2 to 26)
 int getStructuredAppendIndex()
          current symbol in structured append (value 1 to 26)
 void paint(java.awt.Graphics g)
          paints the symbol.
 void setAutoConfigurate(boolean pt)
          allow automatic selection of a larger configuration (than the preferred) if code is too large.
 void setbackColor(java.awt.Color c)
          background color.
 void setbarColor(java.awt.Color c)
          color of the bars.
 void setCode(int[] c)
          bytes to be painted as barcode.
 void setCode(java.lang.String c)
          text to be painted as barcode.
 void setConfigurationType(int pt)
          use this property to define which formats can be used: CONFIGURATION_ANY (any), CONFIGURATION_COMPACT (only compact formats) or CONFIGURATION_FULL (only full range formats).
 void setEncoding(int d)
          Encoding, NORMAL or BINARY
 void setErrorCorrectionLevel(int d)
          Error correction level (5% to 95%).
 void setFileId(java.lang.String s)
          file id in structured append
 void setMargin(int d)
          margin of the barcode (also know as quite zone).
 void setModuleSize(int d)
          size (width) of the bars (module).
 void setPreferredConfiguration(int r)
          use this configuration if possible
 void setProcessTilde(boolean pt)
          process tilde.
 void setReaderInitilization(boolean b)
          activate reader initialization bit
 void setRedraw(boolean b)
          Redraw symbol.
 void setRune(int e)
          Aztec rune's.
 void setStructuredAppend(boolean b)
          activate structured append
 void setStructuredAppendCounter(int i)
          number of symbols in structured append (value 2 to 26)
 void setStructuredAppendIndex(int i)
          current symbol in structured append (value 1 to 26)
 
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, getPreferredSize, 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

CONFIGURATION_ANY

public static int CONFIGURATION_ANY
types of configurations


CONFIGURATION_COMPACT

public static int CONFIGURATION_COMPACT

CONFIGURATION_FULL

public static int CONFIGURATION_FULL

CONFIGURATION_15X15_COMPACT

public static int CONFIGURATION_15X15_COMPACT
available configurations


CONFIGURATION_19X19

public static int CONFIGURATION_19X19

CONFIGURATION_19X19_COMPACT

public static int CONFIGURATION_19X19_COMPACT

CONFIGURATION_23X23

public static int CONFIGURATION_23X23

CONFIGURATION_23X23_COMPACT

public static int CONFIGURATION_23X23_COMPACT

CONFIGURATION_27X27

public static int CONFIGURATION_27X27

CONFIGURATION_27X27_COMPACT

public static int CONFIGURATION_27X27_COMPACT

CONFIGURATION_31X31

public static int CONFIGURATION_31X31

CONFIGURATION_37X37

public static int CONFIGURATION_37X37

CONFIGURATION_41X41

public static int CONFIGURATION_41X41

CONFIGURATION_45X45

public static int CONFIGURATION_45X45

CONFIGURATION_49X49

public static int CONFIGURATION_49X49

CONFIGURATION_53X53

public static int CONFIGURATION_53X53

CONFIGURATION_57X57

public static int CONFIGURATION_57X57

CONFIGURATION_61X61

public static int CONFIGURATION_61X61

CONFIGURATION_67X67

public static int CONFIGURATION_67X67

CONFIGURATION_71X71

public static int CONFIGURATION_71X71

CONFIGURATION_75X75

public static int CONFIGURATION_75X75

CONFIGURATION_79X79

public static int CONFIGURATION_79X79

CONFIGURATION_83X83

public static int CONFIGURATION_83X83

CONFIGURATION_87X87

public static int CONFIGURATION_87X87

CONFIGURATION_91X91

public static int CONFIGURATION_91X91

CONFIGURATION_95X95

public static int CONFIGURATION_95X95

CONFIGURATION_101X101

public static int CONFIGURATION_101X101

CONFIGURATION_105X105

public static int CONFIGURATION_105X105

CONFIGURATION_109X109

public static int CONFIGURATION_109X109

CONFIGURATION_113X113

public static int CONFIGURATION_113X113

CONFIGURATION_117X117

public static int CONFIGURATION_117X117

CONFIGURATION_121X121

public static int CONFIGURATION_121X121

CONFIGURATION_125X125

public static int CONFIGURATION_125X125

CONFIGURATION_131X131

public static int CONFIGURATION_131X131

CONFIGURATION_135X135

public static int CONFIGURATION_135X135

CONFIGURATION_139X139

public static int CONFIGURATION_139X139

CONFIGURATION_143X143

public static int CONFIGURATION_143X143

CONFIGURATION_147X147

public static int CONFIGURATION_147X147

CONFIGURATION_151X151

public static int CONFIGURATION_151X151

ENC_NORMAL

public static int ENC_NORMAL

ENC_BINARY

public static int ENC_BINARY
Constructor Detail

AztecCode

public AztecCode()
Method Detail

getPreferredConfiguration

public int getPreferredConfiguration()
use this configuration if possible


setPreferredConfiguration

public void setPreferredConfiguration(int r)
use this configuration if possible


getCode

public java.lang.String getCode()
text to be painted as barcode.


setCode

public void setCode(java.lang.String c)
text to be painted as barcode.


getCodeBinary

public int[] getCodeBinary()
bytes to be painted as barcode.


setCode

public void setCode(int[] c)
bytes to be painted as barcode.


getMargin

public int getMargin()
margin of the barcode (also know as quite zone). The default is 20 pixels.


setMargin

public void setMargin(int d)
margin of the barcode (also know as quite zone). The default is 20 pixels.


getEncoding

public int getEncoding()
Encoding, NORMAL or BINARY


setEncoding

public void setEncoding(int d)
Encoding, NORMAL or BINARY


getbackColor

public java.awt.Color getbackColor()
background color.


setbackColor

public void setbackColor(java.awt.Color c)
background color.


getbarColor

public java.awt.Color getbarColor()
color of the bars.


setbarColor

public void setbarColor(java.awt.Color c)
color of the bars.


getName

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

Overrides:
getName in class java.awt.Component

getModuleSize

public double getModuleSize()
size (width) of the bars (module).


setModuleSize

public void setModuleSize(int d)
size (width) of the bars (module).


getErrorCorrectionLevel

public int getErrorCorrectionLevel()
Error correction level (5% to 95%). Default is 23 (23%)


setErrorCorrectionLevel

public void setErrorCorrectionLevel(int d)
Error correction level (5% to 95%). Default is 23 (23%)


getProcessTilde

public boolean getProcessTilde()
process tilde.


setProcessTilde

public void setProcessTilde(boolean pt)
process tilde. if true (default) the tilde character (~) will be processed like this:

~~: will be replaced with ~
~dxxx: will be replaced by the character whose ascii code is xxx. For example ~d065 will be replaced with A.
~F: will be replaced with the FNC1 flag (allowed as first codeword only).
~Exxxxxx: will be replaced with the Extended Interpretation Channel flag xxxxxx. For example to activate Extended Interpretation Channel 1, use ~E000001.


getRedraw

public boolean getRedraw()
Redraw symbol


setRedraw

public void setRedraw(boolean b)
Redraw symbol. Set this property to true if you change any property of the barcode and you want to rebuild it.


getAutoConfigurate

public boolean getAutoConfigurate()
allow automatic selection of a larger configuration (than the preferred) if code is too large.


setAutoConfigurate

public void setAutoConfigurate(boolean pt)
allow automatic selection of a larger configuration (than the preferred) if code is too large.


getConfigurationType

public int getConfigurationType()
use this property to define which formats can be used: CONFIGURATION_ANY (any), CONFIGURATION_COMPACT (only compact formats) or CONFIGURATION_FULL (only full range formats).


setConfigurationType

public void setConfigurationType(int pt)
use this property to define which formats can be used: CONFIGURATION_ANY (any), CONFIGURATION_COMPACT (only compact formats) or CONFIGURATION_FULL (only full range formats).


setStructuredAppend

public void setStructuredAppend(boolean b)
activate structured append


getStructuredAppend

public boolean getStructuredAppend()
activate structured append


setFileId

public void setFileId(java.lang.String s)
file id in structured append


getFileId

public java.lang.String getFileId()
file id in structured append


setStructuredAppendCounter

public void setStructuredAppendCounter(int i)
number of symbols in structured append (value 2 to 26)


getStructuredAppendCounter

public int getStructuredAppendCounter()
number of symbols in structured append (value 2 to 26)


setStructuredAppendIndex

public void setStructuredAppendIndex(int i)
current symbol in structured append (value 1 to 26)


getStructuredAppendIndex

public int getStructuredAppendIndex()
current symbol in structured append (value 1 to 26)


setReaderInitilization

public void setReaderInitilization(boolean b)
activate reader initialization bit


getReaderInitilization

public boolean getReaderInitilization()
activate reader initialization bit


paint

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

Overrides:
paint in class java.awt.Canvas

setRune

public void setRune(int e)
Aztec rune's. Deactivate with -1. If greater or equal to 0 the Aztec run will be created


getRune

public int getRune()
Aztec rune's. Deactivate with -1. If greater or equal to 0 the Aztec run will be created


getCurrentX

public int getCurrentX()
get last X possition. Use this property to find out the size in pixels of the barcode.


getCurrentY

public int getCurrentY()
get last Y possition. Use this property to find out the size in pixels of the barcode.