|
||||||||||
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.rbarcode.BarCode
public class BarCode
Main class. This is subclass of the java.awt.Canvas where the barcode will be painted.
Example, how to add RBarcode to your Panel: BarCode bc= new BarCode(); bc.setSize(400 , 200); bc.barType = BarCode.EAN128; bc.resolution=1; bc.leftMarginCM= 50; bc.topMarginCM= 50; bc.checkCharacter =true; bc.code = "1291898"+ ((char) 29)+ "293823"; bc.barColor = java.awt.Color.black; bc.backColor= java.awt.Color.white; bc.fontColor = java.awt.Color.blue; bc.textFont = new java.awt.Font("Arial",java.awt.Font.BOLD,14); bc.X = 1; bc.N = 3; myPanel.add(bc); Example, how to create an image file: BarCode bc= new BarCode(); ... bc.setSize(500,500); // set size of the canvas BarCodeEncoder encoder= new BarCodeEncoder(bc, "JPEG","barcode.jpg"); Example, how to paint on an external Graphics object: BarCode bc= new BarCode(); ... bc.setSize(500,500); // set size of the canvas java.awt.image.BufferedImage image2 = new java.awt.image.BufferedImage(800,800,java.awt.image.BufferedImage.TYPE_BYTE_INDEXED ); bc.paint(image2.createGraphics());
Field Summary | |
---|---|
java.awt.Color |
backColor
background color. |
static int |
BAR39
Code 39 symbology |
static int |
BAR39EXT
Code extended 39 symbology |
java.awt.Color |
barColor
color of the bars.The default value is Color.black. |
double |
barHeightCM
bar height in CM. |
int |
barType
Symbology to be used. |
boolean |
checkCharacter
if true, the checksum character will be calculated and appended to the code. |
static int |
CODABAR
Codebar symbology |
char |
CODABARStartChar
start character for CODABAR. |
char |
CODABARStopChar
stop character for CODABAR. |
java.lang.String |
code
text to be encoded as barcode. |
static int |
CODE11
Code 11 symbology |
static int |
CODE128
Code 128 symbology |
char |
Code128Set
set of character to be used in code 128. |
static int |
CODE93
Code 93 symbology |
static int |
CODE93EXT
Code 93 extended symbology |
java.lang.String |
codeText
text after encoding. |
static int |
DATAMATRIX
Datamatrix symbology (implemented in com/java4less/rdatamatrix/RDataMatrix |
static int |
EAN128
EAN 128 symbology |
static int |
EAN13
EAN 13 symbology |
static int |
EAN8
EAN 8 symbology |
java.awt.Color |
fontColor
color of the text. |
boolean |
guardBars
if true (default), guardbars in EAN and UPC codes will be longer than data bars. |
double |
H
height of bars. |
double |
I
space between 2 characters (code 39). |
static int |
IND25
Industrial 2 of 5 symbology |
static int |
INTERLEAVED25
Interleaved 2 of 5 symbology |
double |
L
Symbol length in CM. |
double |
leftMarginCM
left margin of the barcode (also know as quite zone). |
static int |
MAT25
Matrix 2 of 5 symbology |
static int |
MSI
MSI symbology |
static int |
MSI_CHECKSUM_10
MSI 10 checksum algorithm |
static int |
MSI_CHECKSUM_10_10
MSI 10 + 10 checksum algorithm |
static int |
MSI_CHECKSUM_11
MSI 11 checksum algorithm |
static int |
MSI_CHECKSUM_11_10
MSI 11 + 10 checksum algorithm |
int |
MSIChecksum
MSI checksum algorithm. |
double |
N
multiplicator value for width bars. |
static int |
PDF417
PDF417 symbology (implemented in com/java4less/rbarcode/RBarCode2D |
static int |
POSTNET
Postnet symbology |
double |
postnetHeightShortBar
height in CM of POSTNET's short bars. |
double |
postnetHeightTallBar
height in CM of POSTNET's tall bars. |
boolean |
processTilde
process ~ in code? |
int |
resolution
resolution used to convert from CM to pixels. |
int |
rotate
rotation angle. |
double |
supHeight
height of the supplement. |
java.lang.String |
supplement
user defined 2 or 5 digit supplement for EAN or UPC codes. |
double |
supSeparationCM
Separation in CM between the barcode and the supplement |
java.awt.Font |
textFont
font of the text. |
boolean |
textOnTop
put text on the top of the barcode |
double |
topMarginCM
top margin of the barcode (also know as quite zone). |
static int |
UPCA
UPCA symbology |
static int |
UPCE
UPCE symbology |
boolean |
UPCEANSupplement2
2 digit supplement for EAN or UPC codes. |
boolean |
UPCEANSupplement5
5 digit supplement for EAN or UPC codes. |
char |
UPCESytem
system to be used in UPCE. |
double |
X
size in CM of modules (narrow bars or spaces). |
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 | |
---|---|
BarCode()
|
Method Summary | |
---|---|
int |
getAiLen(java.lang.String d2)
|
java.lang.String |
getEAN128Text(java.lang.String code)
|
int |
getFixedFieldLen(int i)
|
java.awt.Dimension |
getPaintedArea()
return the size of the barcode after it has been painted |
void |
paint(java.awt.Graphics g2)
paints the barcode and rotates it if necessary |
void |
print(java.awt.Graphics g2)
|
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, getName, 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, 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 BAR39
public static final int BAR39EXT
public static final int INTERLEAVED25
public static final int CODE11
public static final int CODABAR
public static final int MSI
public static final int UPCA
public static final int IND25
public static final int MAT25
public static final int CODE93
public static final int EAN13
public static final int EAN8
public static final int UPCE
public static final int CODE128
public static final int CODE93EXT
public static final int POSTNET
public static final int EAN128
public static final int PDF417
public static final int DATAMATRIX
public static final int MSI_CHECKSUM_10
public static final int MSI_CHECKSUM_11
public static final int MSI_CHECKSUM_11_10
public static final int MSI_CHECKSUM_10_10
public boolean textOnTop
public int barType
public java.lang.String code
public boolean checkCharacter
public double postnetHeightTallBar
public double postnetHeightShortBar
public double leftMarginCM
public double topMarginCM
public java.lang.String supplement
public boolean guardBars
public java.awt.Color backColor
public java.lang.String codeText
public int resolution
resolution used to convert from CM to pixels. The value is pixels/CM. The default is 96 dpi. If you set the resolution to 1 then all units are pixels.
public double barHeightCM
public java.awt.Font textFont
public java.awt.Color fontColor
public java.awt.Color barColor
public char UPCESytem
public char CODABARStartChar
public char CODABARStopChar
public boolean UPCEANSupplement2
public boolean UPCEANSupplement5
public char Code128Set
public int MSIChecksum
public double X
public double N
public double I
public double H
public double L
public int rotate
public double supSeparationCM
public double supHeight
public boolean processTilde
the string ~dNNN will be replace by the character for the ascii value NNN. For example d065 stands for A
Constructor Detail |
---|
public BarCode()
Method Detail |
---|
public java.awt.Dimension getPaintedArea()
public void print(java.awt.Graphics g2)
print
in class java.awt.Component
public void paint(java.awt.Graphics g2)
paint
in class java.awt.Canvas
public java.lang.String getEAN128Text(java.lang.String code)
public int getFixedFieldLen(int i)
public int getAiLen(java.lang.String d2)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |