com.idautomation.linear
Class BarCode

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--com.idautomation.linear.BarCode
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class BarCode
extends java.awt.Canvas
implements java.io.Serializable

This is the main class that contains all linear barcode functionality.

See Also:
Serialized Form

Field Summary
 java.awt.Color backColor
          background color.
 java.awt.Color barColor
          color of the bars.
 double barHeightCM
          bar height in CM.
 int barType
          symbology of barcode.
 boolean checkCharacter
          if true, the checksum character will be calculated and appended to the code; Default =True.
 boolean checkCharacterInText
          if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.
static int CODABAR
           
 char CODABARStartChar
          start character for CODABAR.
 char CODABARStopChar
          stop character for CODABAR.
 java.lang.String code
          text to be painted as a barcode.
static int CODE11
           
static int CODE128
           
 char Code128Set
          set of character to be used in code 128.
static int CODE39
           
static int CODE39EXT
           
static int CODE93
           
static int CODE93EXT
           
 java.lang.String codeText
          text after encoding.
static int EAN13
           
static int EAN8
           
 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.
 int height
          initial preferred height property of the bean
 double I
           
static int IND25
           
static int INTERLEAVED25
           
 double L
          Symbol lentgh in CM.
 double leftMarginCM
          left margin of the barcode (also know as quite zone).
static int MAT25
           
static int MSI
           
 double N
          multiplicator value for width bars.
static int PLANET
           
static int POSTNET
           
 double postnetHeightShortBar
          height in CM of POSTNET's short bars.
 double postnetHeightTallBar
          height in CM of POSTNET's tall bars.
 int resolution
          resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.
 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.
 double topMarginCM
          top margin of the barcode (also know as quite zone).
static int UCC128
           
static int UPCA
           
static int UPCE
           
 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.
 int width
          initial preferred width property of the bean
 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
 java.awt.Color getBackground()
          gets the background color.
 double getBarHeightCM()
          gets bar height in CM.
 boolean getCheckCharacter()
          if true, the checksum character will be calculated and appended to the code; Default =True.
 boolean getCheckCharacterInText()
          if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.
 java.lang.String getCODABARStartChar()
          gets the start character for CODABAR.
 java.lang.String getCODABARStopChar()
          gets the stop character for CODABAR.
 java.lang.String getCode128Set()
          gets the character set to be used in code 128.
 java.lang.String getDataToEncode()
          text that was painted as a barcode.
 java.awt.Font getFont()
          gets the font of the text.
 java.awt.Color getForeground()
          gets color of the bars.
 double getLeftMarginCM()
          returns the left margin of the barcode (also know as quite zone).
 java.awt.Dimension getMinimumSize()
           
 double getNarrowToWideRatio()
          gets the multiplicator value for width bars.
 int getPixelsPerCM()
          gets the resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.
 double getPostnetHeightShort()
          returns the height in CM of POSTNET's short bars.
 double getPostnetHeightTall()
          returns the height in CM of POSTNET's tall bars.
 java.awt.Dimension getPreferredSize()
          returns a size appropriate for the barcode generated, the initial size is 170,70.
 int getRotationAngle()
          gets the rotation angle.
 java.lang.String getSupplementToEncode()
          gets the user defined 2 or 5 digit supplement for EAN or UPC codes.
 int getSymbologyID()
          Returns the symbology type; CODE39=0; CODE39EXT=1; INTERLEAVED25=2; CODE11=3; CODABAR=4; MSI=5; UPCA=6; IND25=7; MAT25=8; CODE93=9; EAN13=10; EAN8=11; UPCE=12; CODE128=13; CODE93EXT=14; POSTNET=15; PLANET=16; UCC128=17; the default is CODE128.
 java.awt.Color getTextFontColor()
          gets color of the text.
 double getTopMarginCM()
          returns the top margin of the barcode (also know as quite zone).
 boolean getUPCEANSupplement2()
          gets the 2 digit supplement for EAN or UPC codes.
 boolean getUPCEANSupplement5()
          gets the 5 digit supplement for EAN or UPC codes.
 java.lang.String getUPCESytem()
          gets the system to be used in UPCE.
 double getXDimensionCM()
          gets the size in CM of modules (narrow bars or spaces).
 void paint(java.awt.Graphics g2)
          paints the barcode and rotates it if necessary
 void setBackground(java.awt.Color newColor)
          sets the background color.
 void setBarHeightCM(double newBarHeight)
          sets bar height in CM.
 void setCheckCharacter(boolean newChk)
          if true, the checksum character will be calculated and appended to the code; Default =True.
 void setCheckCharacterInText(boolean newVal)
          if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.
 void setCODABARStartChar(java.lang.String newSet)
          sets the start character for CODABAR.
 void setCODABARStopChar(java.lang.String newSet)
          sets the stop character for CODABAR.
 void setCode128Set(java.lang.String newSet)
          sets the character set to be used in code 128.
 void setDataToEncode(java.lang.String newCode)
          text to be painted as a barcode.
 void setFont(java.awt.Font newFont)
          sets the font of the text.
 void setForeground(java.awt.Color newColor)
          sets color of the bars.
 void setLeftMarginCM(double newMargin)
          left margin of the barcode (also know as quite zone).
 void setNarrowToWideRatio(double newN)
          sets the multiplicator value for width bars.
 void setPixelsPerCM(int newRes)
          sets the resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.
 void setPostnetHeightShort(double newHeight)
          height in CM of POSTNET's short bars.
 void setPostnetHeightTall(double newHeight)
          height in CM of POSTNET's tall bars.
 void setRotationAngle(int newRotate)
          sets the rotation angle.
 void setSupplementToEncode(java.lang.String newCode)
          sets the user defined 2 or 5 digit supplement for EAN or UPC codes.
 void setSymbologyID(int newSym)
          To change the symbology type, set the appropriate number for the SymbologyID property: CODE39=0; CODE39EXT=1; INTERLEAVED25=2; CODE11=3; CODABAR=4; MSI=5; UPCA=6; IND25=7; MAT25=8; CODE93=9; EAN13=10; EAN8=11; UPCE=12; CODE128=13; CODE93EXT=14; POSTNET=15; PLANET=16; UCC128=17; the default is CODE128.
 void setTextFontColor(java.awt.Color newColor)
          sets color of the text.
 void setTopMarginCM(double newMargin)
          top margin of the barcode (also know as quite zone).
 void setUPCEANSupplement2(boolean newval)
          sets the 2 digit supplement for EAN or UPC codes.
 void setUPCEANSupplement5(boolean newval)
          sets the 5 digit supplement for EAN or UPC codes.
 void setUPCESytem(java.lang.String newSet)
          sets the system to be used in UPCE.
 void setXDimensionCM(double newX)
          sets the size in CM of modules (narrow bars or spaces).
 
Methods inherited from class java.awt.Canvas
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFontMetrics, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, 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, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CODE39

public static final int CODE39

CODE39EXT

public static final int CODE39EXT

INTERLEAVED25

public static final int INTERLEAVED25

CODE11

public static final int CODE11

CODABAR

public static final int CODABAR

MSI

public static final int MSI

UPCA

public static final int UPCA

IND25

public static final int IND25

MAT25

public static final int MAT25

CODE93

public static final int CODE93

EAN13

public static final int EAN13

EAN8

public static final int EAN8

UPCE

public static final int UPCE

CODE128

public static final int CODE128

CODE93EXT

public static final int CODE93EXT

POSTNET

public static final int POSTNET

PLANET

public static final int PLANET

UCC128

public static final int UCC128

barType

public int barType
symbology of barcode. Default = CODE128.

code

public java.lang.String code
text to be painted as a barcode.

checkCharacter

public boolean checkCharacter
if true, the checksum character will be calculated and appended to the code; Default =True.

checkCharacterInText

public boolean checkCharacterInText
if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.

postnetHeightTallBar

public double postnetHeightTallBar
height in CM of POSTNET's tall bars. The default is 0.3

postnetHeightShortBar

public double postnetHeightShortBar
height in CM of POSTNET's short bars. The default is 0.125

leftMarginCM

public double leftMarginCM
left margin of the barcode (also know as quite zone). The default is .2 CM.

topMarginCM

public double topMarginCM
top margin of the barcode (also know as quite zone). The default is .5 CM

supplement

public java.lang.String supplement
user defined 2 or 5 digit supplement for EAN or UPC codes.

guardBars

public boolean guardBars
if true (default), guardbars in EAN and UPC codes will be longer than data bars.

backColor

public java.awt.Color backColor
background color.

codeText

public java.lang.String codeText
text after encoding. It will contain the appended checksum, if calculated.

resolution

public int resolution
resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.

barHeightCM

public double barHeightCM
bar height in CM. If 0 it will be calculated using H.

width

public int width
initial preferred width property of the bean

height

public int height
initial preferred height property of the bean

textFont

public java.awt.Font textFont
font of the text.

fontColor

public java.awt.Color fontColor
color of the text.

barColor

public java.awt.Color barColor
color of the bars.

UPCESytem

public char UPCESytem
system to be used in UPCE. It can be "0" or "1". The default is "1".

CODABARStartChar

public char CODABARStartChar
start character for CODABAR. The default is A.

CODABARStopChar

public char CODABARStopChar
stop character for CODABAR. The default is B.

UPCEANSupplement2

public boolean UPCEANSupplement2
2 digit supplement for EAN or UPC codes.

UPCEANSupplement5

public boolean UPCEANSupplement5
5 digit supplement for EAN or UPC codes.

Code128Set

public char Code128Set
set of character to be used in code 128. Possible values are "A", "B" or "C". The default is "B"

X

public double X
size in CM of modules (narrow bars or spaces). The resolution is used to convert to pixels.

N

public double N
multiplicator value for width bars. A value of 2 (default) means that wide bars will be 2*N CM width.

I

public double I

H

public double H
height of bars. This a multiplicator of X. The default is 0.45.

L

public double L
Symbol lentgh in CM. This is calculated and the user can read it.

rotate

public int rotate
rotation angle. Valid values are 0 (default), 90, 180 & 270.

supSeparationCM

public double supSeparationCM
Separation in CM between the barcode and the supplement

supHeight

public double supHeight
height of the supplement. This is a multiplicator of the height of the code. The default is 0.8 (80%).
Constructor Detail

BarCode

public BarCode()
Method Detail

setSymbologyID

public void setSymbologyID(int newSym)
To change the symbology type, set the appropriate number for the SymbologyID property: CODE39=0; CODE39EXT=1; INTERLEAVED25=2; CODE11=3; CODABAR=4; MSI=5; UPCA=6; IND25=7; MAT25=8; CODE93=9; EAN13=10; EAN8=11; UPCE=12; CODE128=13; CODE93EXT=14; POSTNET=15; PLANET=16; UCC128=17; the default is CODE128.

getSymbologyID

public int getSymbologyID()
Returns the symbology type; CODE39=0; CODE39EXT=1; INTERLEAVED25=2; CODE11=3; CODABAR=4; MSI=5; UPCA=6; IND25=7; MAT25=8; CODE93=9; EAN13=10; EAN8=11; UPCE=12; CODE128=13; CODE93EXT=14; POSTNET=15; PLANET=16; UCC128=17; the default is CODE128.

setDataToEncode

public void setDataToEncode(java.lang.String newCode)
text to be painted as a barcode.

getDataToEncode

public java.lang.String getDataToEncode()
text that was painted as a barcode.

setCheckCharacter

public void setCheckCharacter(boolean newChk)
if true, the checksum character will be calculated and appended to the code; Default =True.

getCheckCharacter

public boolean getCheckCharacter()
if true, the checksum character will be calculated and appended to the code; Default =True.

setCheckCharacterInText

public void setCheckCharacterInText(boolean newVal)
if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.

getCheckCharacterInText

public boolean getCheckCharacterInText()
if true, the checksum character will be appended to the human readable text; Default =True; checksum characters cannot by displayed for Code 128.

setPostnetHeightTall

public void setPostnetHeightTall(double newHeight)
height in CM of POSTNET's tall bars. The default is 0.3

getPostnetHeightTall

public double getPostnetHeightTall()
returns the height in CM of POSTNET's tall bars. The default is 0.3

setPostnetHeightShort

public void setPostnetHeightShort(double newHeight)
height in CM of POSTNET's short bars. The default is 0.125

getPostnetHeightShort

public double getPostnetHeightShort()
returns the height in CM of POSTNET's short bars. The default is 0.125

setLeftMarginCM

public void setLeftMarginCM(double newMargin)
left margin of the barcode (also know as quite zone). The default is .2 CM.

getLeftMarginCM

public double getLeftMarginCM()
returns the left margin of the barcode (also know as quite zone). The default is .2 CM.

setTopMarginCM

public void setTopMarginCM(double newMargin)
top margin of the barcode (also know as quite zone). The default is .5 CM

getTopMarginCM

public double getTopMarginCM()
returns the top margin of the barcode (also know as quite zone). The default is .5 CM

setSupplementToEncode

public void setSupplementToEncode(java.lang.String newCode)
sets the user defined 2 or 5 digit supplement for EAN or UPC codes.

getSupplementToEncode

public java.lang.String getSupplementToEncode()
gets the user defined 2 or 5 digit supplement for EAN or UPC codes.

setBackground

public void setBackground(java.awt.Color newColor)
sets the background color.
Overrides:
setBackground in class java.awt.Component

getBackground

public java.awt.Color getBackground()
gets the background color.
Overrides:
getBackground in class java.awt.Component

setPixelsPerCM

public void setPixelsPerCM(int newRes)
sets the resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.

getPixelsPerCM

public int getPixelsPerCM()
gets the resolution used to convert from CM to pixels; Default is the screen resolution of pixels per CM.

setBarHeightCM

public void setBarHeightCM(double newBarHeight)
sets bar height in CM. If 0 it will be calculated using H.

getBarHeightCM

public double getBarHeightCM()
gets bar height in CM. If 0 it will be calculated using H.

getPreferredSize

public java.awt.Dimension getPreferredSize()
returns a size appropriate for the barcode generated, the initial size is 170,70.
Overrides:
getPreferredSize in class java.awt.Component

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Component

setFont

public void setFont(java.awt.Font newFont)
sets the font of the text.
Overrides:
setFont in class java.awt.Component

getFont

public java.awt.Font getFont()
gets the font of the text.
Overrides:
getFont in class java.awt.Component

setTextFontColor

public void setTextFontColor(java.awt.Color newColor)
sets color of the text.

getTextFontColor

public java.awt.Color getTextFontColor()
gets color of the text.

setForeground

public void setForeground(java.awt.Color newColor)
sets color of the bars.
Overrides:
setForeground in class java.awt.Component

getForeground

public java.awt.Color getForeground()
gets color of the bars.
Overrides:
getForeground in class java.awt.Component

setUPCESytem

public void setUPCESytem(java.lang.String newSet)
sets the system to be used in UPCE. It can be "0" or "1". The default is "1".

getUPCESytem

public java.lang.String getUPCESytem()
gets the system to be used in UPCE. It can be "0" or "1".

setCODABARStartChar

public void setCODABARStartChar(java.lang.String newSet)
sets the start character for CODABAR. The default is A.

getCODABARStartChar

public java.lang.String getCODABARStartChar()
gets the start character for CODABAR.

setCODABARStopChar

public void setCODABARStopChar(java.lang.String newSet)
sets the stop character for CODABAR. The default is B.

getCODABARStopChar

public java.lang.String getCODABARStopChar()
gets the stop character for CODABAR. The default is B.

setUPCEANSupplement2

public void setUPCEANSupplement2(boolean newval)
sets the 2 digit supplement for EAN or UPC codes.

getUPCEANSupplement2

public boolean getUPCEANSupplement2()
gets the 2 digit supplement for EAN or UPC codes.

setUPCEANSupplement5

public void setUPCEANSupplement5(boolean newval)
sets the 5 digit supplement for EAN or UPC codes.

getUPCEANSupplement5

public boolean getUPCEANSupplement5()
gets the 5 digit supplement for EAN or UPC codes.

setCode128Set

public void setCode128Set(java.lang.String newSet)
sets the character set to be used in code 128. Possible values are "A", "B" or "C". The default is "B"

getCode128Set

public java.lang.String getCode128Set()
gets the character set to be used in code 128. Possible values are "A", "B" or "C".

setXDimensionCM

public void setXDimensionCM(double newX)
sets the size in CM of modules (narrow bars or spaces). The resolution is used to convert to pixels.

getXDimensionCM

public double getXDimensionCM()
gets the size in CM of modules (narrow bars or spaces). The resolution is used to convert to pixels.

setNarrowToWideRatio

public void setNarrowToWideRatio(double newN)
sets the multiplicator value for width bars. A value of 2 (default) means that wide bars will be 2*N CM width.

getNarrowToWideRatio

public double getNarrowToWideRatio()
gets the multiplicator value for width bars. A value of 2 (default) means that wide bars will be 2*N CM width.

setRotationAngle

public void setRotationAngle(int newRotate)
sets the rotation angle. Valid values are 0 (default), 90, 180 & 270.

getRotationAngle

public int getRotationAngle()
gets the rotation angle. Valid values are 0 (default), 90, 180 & 270.

paint

public void paint(java.awt.Graphics g2)
paints the barcode and rotates it if necessary
Overrides:
paint in class java.awt.Canvas