|
|||||||||||
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
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 inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
protected double |
barHeight
|
protected double |
barWidth
|
protected java.lang.String |
data
|
protected boolean |
drawingText
|
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.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
protected |
Barcode(java.lang.String data)
|
Method Summary | |
protected java.lang.String |
beautify(java.lang.String s)
|
protected abstract Module |
calculateChecksum()
|
protected double |
calculateMinimumBarHeight(int resolution)
|
void |
draw(java.awt.Graphics2D g,
int x,
int y)
Renders this Barcode at the specified location in
the specified Graphics2D context. |
protected double |
drawModule(Module module,
AbstractOutput params,
double x,
double y)
|
protected abstract Module[] |
encodeData()
|
protected abstract double |
getBarcodeWidth(int resolution)
|
java.awt.Rectangle |
getBounds()
From JComponent . |
java.awt.Rectangle |
getBounds(java.awt.Rectangle rv)
From JComponent . |
java.lang.String |
getData()
Returns the data that the barcode is coding for. |
int |
getHeight()
From JComponent . |
protected java.lang.String |
getLabel()
Returns the text that will be displayed underneath the barcode (if requested). |
java.awt.Dimension |
getMaximumSize()
From JComponent . |
java.awt.Dimension |
getMinimumSize()
From JComponent . |
protected abstract Module |
getPostAmble()
|
protected abstract Module |
getPreAmble()
|
java.awt.Dimension |
getPreferredSize()
From JComponent . |
protected int |
getResolution()
|
java.awt.Dimension |
getSize()
From JComponent . |
java.lang.String |
getSVG()
|
int |
getWidth()
From JComponent . |
int |
getX()
From JComponent . |
int |
getY()
From JComponent . |
boolean |
isDrawingText()
Indicates whether the barcode is drawing a text label underneath the barcode or not. |
void |
outputSVG(java.io.Writer out)
|
protected void |
paintComponent(java.awt.Graphics g)
From JComponent . |
void |
setBarHeight(double barHeight)
Sets the desired height for the bars in the barcode (in pixels). |
void |
setBarWidth(double barWidth)
Sets the desired bar width for the barcode. |
void |
setDrawingText(boolean drawingText)
Indicates whether the barcode data should be shown as a string underneath the barcode or not. |
void |
setFont(java.awt.Font font)
Sets the font to use when drawing the barcode data string underneath the barcode. |
void |
setResolution(int resolution)
Sets the desired output resolution for the barcode. |
void |
setSVGScalar(double scalar,
java.lang.String units)
|
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String data
protected boolean drawingText
protected double barWidth
protected double barHeight
Constructor Detail |
protected Barcode(java.lang.String data) throws BarcodeException
Method Detail |
public java.lang.String getData()
public void setFont(java.awt.Font font)
font
- The font to usepublic void setDrawingText(boolean drawingText)
drawingText
- True if the text should be shown, false if notpublic boolean isDrawingText()
public void setBarWidth(double barWidth)
barWidth
- The desired width of the thinnest bar in pixelspublic void setBarHeight(double 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
.
public int getY()
JComponent
.
public int getWidth()
JComponent
.
public int getHeight()
JComponent
.
public java.awt.Rectangle getBounds()
JComponent
.
public java.awt.Rectangle getBounds(java.awt.Rectangle rv)
JComponent
.
rv
- The rectangle to set the bounds on
public java.awt.Dimension getPreferredSize()
JComponent
.
public java.awt.Dimension getMinimumSize()
JComponent
.
public java.awt.Dimension getMaximumSize()
JComponent
.
public java.awt.Dimension getSize()
JComponent
.
public void draw(java.awt.Graphics2D g, int x, int y)
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 boxprotected abstract double getBarcodeWidth(int resolution)
protected abstract Module[] encodeData()
protected abstract Module calculateChecksum()
protected abstract Module getPreAmble()
protected abstract Module getPostAmble()
protected java.lang.String getLabel()
protected double calculateMinimumBarHeight(int resolution)
protected void paintComponent(java.awt.Graphics g)
JComponent
.
g
- The graphics to paint the component ontoprotected int getResolution()
protected double drawModule(Module module, AbstractOutput params, double x, double y)
protected java.lang.String beautify(java.lang.String s)
public java.lang.String getSVG()
public void outputSVG(java.io.Writer out)
public void setSVGScalar(double scalar, java.lang.String units)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |