|
|||||||||
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.microqrcode.MicroQRCode
public class MicroQRCode
This class creates Micro 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:
MicroQRCode barcode=new MicroQRCode();
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
R
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_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
|
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 | |
---|---|
MicroQRCode()
|
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 |
getCurrentX()
get last X possition. |
int |
getCurrentY()
get last Y possition. |
int |
getEncoding()
Encoding mode (default is AUTO). |
int |
getErrorCorrectionLevel()
Error correction level. |
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 |
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 |
setEncoding(int d)
Encoding mode (default is AUTO). |
void |
setErrorCorrectionLevel(int d)
Error correction level. |
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. |
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 int CORRECTION_LEVEL_L
public static int CORRECTION_LEVEL_M
public static int CORRECTION_LEVEL_Q
Constructor Detail |
---|
public MicroQRCode()
Method Detail |
---|
public int getPreferredVersion()
public void setPreferredVersion(int r)
public java.lang.String getCode()
public void setCode(java.lang.String c)
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 boolean getAutoConfigurate()
public void setAutoConfigurate(boolean pt)
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 |