|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Canvas
com.java4less.qrcode.QRCode
public class QRCode
This class creates QR 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:
QRCode barcode=new QRCode();
barcode.setCode("ABC");
barcode.setSize(300,300);
ImageEncoder be= new 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);
Field Summary | |
---|---|
static int |
CORRECTION_LEVEL_H
|
static int |
CORRECTION_LEVEL_L
|
static int |
CORRECTION_LEVEL_M
|
static int |
CORRECTION_LEVEL_Q
|
static int |
ENC_ALPHA
|
static int |
ENC_AUTO
|
static int |
ENC_BYTE
|
static int |
ENC_KANJI
|
static int |
ENC_NUMERIC
|
static int |
FNC1_MODE_FIRST
|
static int |
FNC1_MODE_NO
|
static int |
FNC1_MODE_SECOND
|
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 | |
---|---|
QRCode()
|
Method Summary | |
---|---|
byte |
getApplicationIndicator()
application indicator if Fnc1Mode is FNC1_MODE_SECOND |
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 |
getCurrentX()
get last X possition. |
int |
getCurrentY()
get last Y possition. |
int |
getECI()
Extended Channel Interpretation. |
int |
getEncoding()
Encoding mode (default is AUTO). |
int |
getErrorCorrectionLevel()
Error correction level. |
int |
getFnc1Mode()
get FNC1 mode (FNC1_MODE_NO, FNC1_MODE_FIRST or FNC1_MODE_SECOND) |
int |
getMargin()
margin of the barcode (also know as quite zone). |
double |
getModuleSize()
size (width) of the bars (module). |
java.lang.String |
getName()
Returns "QRCode". |
int |
getPreferredVersion()
use this configuration if possible. |
boolean |
getProcessTilde()
process tilde. |
boolean |
getRedraw()
Redraw symbol |
boolean |
getStructuredAppend()
activate structured append |
int |
getStructuredAppendCounter()
number of symbols in structured append (value 1 to 16) |
int |
getStructuredAppendIndex()
current symbol in structured append (value 1 to 16) |
void |
paint(java.awt.Graphics g)
paints the symbol. |
void |
setApplicationIndicator(byte b)
application indicator if Fnc1Mode is FNC1_MODE_SECOND |
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 |
setECI(int v)
Extended Channel Interpretation. |
void |
setEncoding(int d)
Encoding mode (default is AUTO). |
void |
setErrorCorrectionLevel(int d)
Error correction level. |
void |
setFnc1Mode(int mode)
sets the FNC1 mode (FNC1_MODE_NO, FNC1_MODE_FIRST or FNC1_MODE_SECOND) |
void |
setMargin(int d)
margin of the barcode (also know as quite zone). |
void |
setModuleSize(int d)
size (width) of the bars (module). |
void |
setPreferredVersion(int r)
use this configuration if possible. |
void |
setProcessTilde(boolean pt)
process tilde. |
void |
setRedraw(boolean b)
Redraw symbol. |
void |
setStructuredAppend(boolean b)
activate structured append |
void |
setStructuredAppendCounter(int i)
number of symbols in structured append (value 1 to 16) |
void |
setStructuredAppendIndex(int i)
current symbol in structured append (value 1 to 16) |
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 |
---|
public static final int ENC_ALPHA
public static final int ENC_BYTE
public static final int ENC_NUMERIC
public static final int ENC_KANJI
public static final int ENC_AUTO
public static final int FNC1_MODE_NO
public static final int FNC1_MODE_FIRST
public static final int FNC1_MODE_SECOND
public static int CORRECTION_LEVEL_L
public static int CORRECTION_LEVEL_M
public static int CORRECTION_LEVEL_Q
public static int CORRECTION_LEVEL_H
Constructor Detail |
---|
public QRCode()
Method Detail |
---|
public int getPreferredVersion()
public void setPreferredVersion(int r)
public java.lang.String getCode()
public void setCode(java.lang.String c)
public int getECI()
public void setECI(int v)
public int[] getCodeBinary()
public void setCode(int[] c)
public int getMargin()
public void setMargin(int d)
public int getEncoding()
Encoding mode (default is AUTO). Valid values are:
public void setEncoding(int d)
Encoding mode (default is AUTO). Valid values are:
public java.awt.Color getBackColor()
public void setBackColor(java.awt.Color c)
public java.awt.Color getBarColor()
public void setBarColor(java.awt.Color c)
public java.lang.String getName()
getName
in class java.awt.Component
public double getModuleSize()
public void setModuleSize(int d)
public int getErrorCorrectionLevel()
Error correction level. Valid values are:
public void setErrorCorrectionLevel(int d)
Error correction level. Valid values are:
public boolean getProcessTilde()
public void setProcessTilde(boolean pt)
public boolean getRedraw()
public void setRedraw(boolean b)
public int getFnc1Mode()
public void setFnc1Mode(int mode)
public byte getApplicationIndicator()
public void setApplicationIndicator(byte b)
public boolean getAutoConfigurate()
public void setAutoConfigurate(boolean pt)
public void setStructuredAppend(boolean b)
public boolean getStructuredAppend()
public void setStructuredAppendCounter(int i)
public int getStructuredAppendCounter()
public void setStructuredAppendIndex(int i)
public int getStructuredAppendIndex()
public void paint(java.awt.Graphics g)
paint
in class java.awt.Canvas
public int getCurrentX()
public int getCurrentY()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |