|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
net.sourceforge.barbecue.Barcode
public abstract class Barcode
Abstract barcode class that provides functionality that is common to all barcodes. Specific barcode implementations must subclass this and provide information specific to the barcode type they are implementing.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int |
barHeight
|
protected int |
barWidth
|
protected String |
data
|
protected boolean |
drawingQuietSection
|
protected boolean |
drawingText
|
protected String |
label
|
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.print.Printable |
|---|
NO_SUCH_PAGE, PAGE_EXISTS |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
protected |
Barcode(String data)
|
| Method Summary | |
|---|---|
protected String |
beautify(String s)
|
protected abstract Module |
calculateChecksum()
|
protected int |
calculateMinimumBarHeight(int resolution)
|
void |
draw(Graphics2D g,
int x,
int y)
Renders this Barcode at the specified location in
the specified Graphics2D context. |
protected abstract Dimension |
draw(Output output,
int x,
int y,
int barWidth,
int barHeight)
|
protected int |
drawModule(Module module,
Output output,
int x,
int y,
int barWidth,
int barHeight)
|
protected abstract Module[] |
encodeData()
|
Rectangle |
getBounds()
From JComponent. |
Rectangle |
getBounds(Rectangle rv)
From JComponent. |
String |
getData()
Returns the data that the barcode is coding for. |
int |
getHeight()
From JComponent. |
String |
getLabel()
Returns the text that will be displayed underneath the barcode (if requested). |
Dimension |
getMaximumSize()
From JComponent. |
Dimension |
getMinimumSize()
From JComponent. |
protected abstract Module |
getPostAmble()
|
protected abstract Module |
getPreAmble()
|
Dimension |
getPreferredSize()
From JComponent. |
protected int |
getResolution()
|
Dimension |
getSize()
From JComponent. |
int |
getWidth()
From JComponent. |
int |
getX()
From JComponent. |
int |
getY()
From JComponent. |
boolean |
isDrawingQuietSection()
Indicates whether the barcode is drawing leading and trailing white space/quiet area. |
boolean |
isDrawingText()
Indicates whether the barcode is drawing a text label underneath the barcode or not. |
void |
output(Output output)
|
protected void |
paintComponent(Graphics g)
From JComponent. |
int |
print(Graphics g,
PageFormat pageFormat,
int pageIndex)
|
void |
setBarHeight(int barHeight)
Sets the desired height for the bars in the barcode (in pixels). |
void |
setBarWidth(int barWidth)
Sets the desired bar width for the barcode. |
void |
setDrawingQuietSection(boolean drawingQuietSection)
Indicates whether the leading and trailing white space should be rendered. |
void |
setDrawingText(boolean drawingText)
Indicates whether the barcode data should be shown as a string underneath the barcode or not. |
void |
setFont(Font font)
Sets the font to use when drawing the barcode data string underneath the barcode. |
void |
setLabel(String label)
Sets the human readable text to be displayed underneath the barcode. |
void |
setResolution(int resolution)
Sets the desired output resolution for the barcode. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected String data
protected String label
protected boolean drawingText
protected boolean drawingQuietSection
protected int barWidth
protected int barHeight
| Constructor Detail |
|---|
protected Barcode(String data)
throws BarcodeException
BarcodeException| Method Detail |
|---|
public String getData()
public void setFont(Font font)
setFont in class JComponentfont - The font to usepublic void setDrawingText(boolean drawingText)
drawingText - True if the text should be shown, false if notpublic boolean isDrawingText()
public void setDrawingQuietSection(boolean drawingQuietSection)
drawingQuietSection - True if the quiet area/white space should be shown, false if notpublic boolean isDrawingQuietSection()
public void setBarWidth(int barWidth)
barWidth - The desired width of the thinnest bar in pixelspublic void setBarHeight(int barHeight)
barHeight - The desired height of the barcode bars in pixelspublic void setResolution(int resolution)
resolution - The desired output resolution (in dots per inch)public int getX()
JComponent.
getX in class JComponentpublic int getY()
JComponent.
getY in class JComponentpublic int getWidth()
JComponent.
getWidth in class JComponentpublic int getHeight()
JComponent.
getHeight in class JComponentpublic Rectangle getBounds()
JComponent.
getBounds in class Componentpublic Rectangle getBounds(Rectangle rv)
JComponent.
getBounds in class JComponentrv - The rectangle to set the bounds on
public Dimension getPreferredSize()
JComponent.
getPreferredSize in class JComponentpublic Dimension getMinimumSize()
JComponent.
getMinimumSize in class JComponentpublic Dimension getMaximumSize()
JComponent.
getMaximumSize in class JComponentpublic Dimension getSize()
JComponent.
getSize in class Component
public void draw(Graphics2D g,
int x,
int y)
throws OutputException
Barcode at the specified location in
the specified Graphics2D context.
The origin of the layout is placed at x, y. Rendering may touch
any point within getBounds() of this position. This
leaves the g2 unchanged.
g - The graphics contextx - The horizontal value of the upper left co-ordinate of the bounding boxy - The vertical value of the upper left co-ordinate of the bounding box
OutputException
public void output(Output output)
throws OutputException
OutputExceptionprotected abstract Module[] encodeData()
protected abstract Module calculateChecksum()
protected abstract Module getPreAmble()
protected abstract Module getPostAmble()
protected abstract Dimension draw(Output output,
int x,
int y,
int barWidth,
int barHeight)
throws OutputException
OutputExceptionpublic String getLabel()
public void setLabel(String label)
label - the human readable barcode textgetLabel()protected int calculateMinimumBarHeight(int resolution)
protected void paintComponent(Graphics g)
JComponent.
paintComponent in class JComponentg - The graphics to paint the component ontoprotected int getResolution()
protected int drawModule(Module module,
Output output,
int x,
int y,
int barWidth,
int barHeight)
throws OutputException
OutputExceptionprotected String beautify(String s)
public int print(Graphics g,
PageFormat pageFormat,
int pageIndex)
throws PrinterException
print in interface PrintablePrinterExceptionpublic String toString()
toString in class Component
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||