|
||||||||||
| 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
javax.swing.JLabel
org.tentackle.print.PrintLabel
public class PrintLabel
Text printing bean.
This is the base class for all text-field based printing beans.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JLabel |
|---|
JLabel.AccessibleJLabel |
| 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 Object |
value
last printed value |
| Fields inherited from class javax.swing.JLabel |
|---|
labelFor |
| 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 javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
PrintLabel()
Creates a print label with minimum width and a LEADING horizontal alignment. |
|
PrintLabel(int columns)
Creates a print label with a LEADING horizontal alignment. |
|
PrintLabel(int columns,
int horizontalAlignment)
Creates a print label. |
|
PrintLabel(String text,
int columns,
int horizontalAlignment)
Creates a print label. |
|
| Method Summary | |
|---|---|
int |
getColumns()
Gets the column width. |
protected int |
getColumnWidth()
Gets the column width. |
int |
getPreferredHeight()
Gets the preferred height. |
Dimension |
getPreferredSize()
If the preferredSize has been set to a
non-null value just returns it. |
int |
getPreferredWidth()
Gets the preferred width. |
Object |
getPrintValue()
Gets the value to be printed |
void |
setBounds(int x,
int y,
int width,
int height)
Moves and resizes this component. |
void |
setBounds(Rectangle r)
Moves and resizes this component to conform to the new bounding rectangle r. |
void |
setColumns(int columns)
Sets the width according to the number of columns. |
void |
setFont(Font font)
Sets the font for this component. |
void |
setPreferredHeight(int height)
Sets the height to control Labelsize without automatic FontMetrics. |
void |
setPreferredWidth(int width)
Sets the width to control Labelsize without automatic FontMetrics. |
void |
setPrintValue(Object value)
Sets the value to be printed |
void |
setSize(Dimension d)
Resizes this component so that it has width d.width
and height d.height. |
void |
setSize(int width,
int height)
Resizes this component so that it has width width
and height height. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Object value
| Constructor Detail |
|---|
public PrintLabel(String text,
int columns,
int horizontalAlignment)
text - the initial text, null = nonecolumns - the width in columns, 0 = minimum widthhorizontalAlignment - the horizontal alignmentJLabel
public PrintLabel(int columns,
int horizontalAlignment)
columns - the width in columns, 0 = minimum widthhorizontalAlignment - the horizontal alignmentJLabelpublic PrintLabel(int columns)
columns - the width in columns, 0 = minimum widthJLabelpublic PrintLabel()
JLabel| Method Detail |
|---|
public void setColumns(int columns)
columns - the columns, 0 = minimum width (default)
IllegalArgumentException - if width is negativepublic int getColumns()
protected int getColumnWidth()
The meaning of what a column is can be considered a fairly weak notion for some fonts. This method is used to define the width of a column. By default this is defined to be the width of the character m for the font used. This method can be redefined to be some alternative amount
public void setFont(Font font)
Overridden to clear columnWidth.
setFont in class JComponentfont - the desired Font for this componentComponent.getFont()public Dimension getPreferredSize()
preferredSize has been set to a
non-null value just returns it.
If the UI delegate's getPreferredSize
method returns a non null value then return that;
otherwise defer to the component's layout manager.
Overridden to allow columns to be honored and the preferred fixed width/height Returns the preferred size Dimensions needed for this TextField. If a non-zero number of columns has been set, the width is set to the columns multiplied by the column width.
getPreferredSize in class JComponentpreferredSize propertyJComponent.setPreferredSize(java.awt.Dimension),
ComponentUIpublic void setPreferredHeight(int height)
height - the preferred height, 0 = automatic according to fontpublic int getPreferredHeight()
public void setPreferredWidth(int width)
width - the preferred width, 0 = automatic according to fontpublic int getPreferredWidth()
public void setBounds(int x,
int y,
int width,
int height)
x and y, and the
new size is specified by width and height.
Overridden to allow columns to be honored.
setBounds in class Componentx - the new x-coordinate of this componenty - the new y-coordinate of this componentwidth - the new width of this componentheight - the new height of this
componentComponent.getBounds(),
Component.setLocation(int, int),
Component.setLocation(Point),
Component.setSize(int, int),
Component.setSize(Dimension)public void setBounds(Rectangle r)
java.awt.Componentr. This component's new
position is specified by r.x and r.y,
and its new size is specified by r.width and
r.height
setBounds in class Componentr - the new bounding rectangle for this componentComponent.getBounds(),
Component.setLocation(int, int),
Component.setLocation(Point),
Component.setSize(int, int),
Component.setSize(Dimension)public void setSize(Dimension d)
d.width
and height d.height.
Overridden due to setBounds().
setSize in class Componentd - the dimension specifying the new size
of this componentComponent.setSize(int, int),
Component.setBounds(int, int, int, int)
public void setSize(int width,
int height)
width
and height height.
Overridden due to setBounds().
setSize in class Componentwidth - the new width of this component in pixelsheight - the new height of this component in pixelsComponent.getSize(),
Component.setBounds(int, int, int, int)public void setPrintValue(Object value)
PrintComponent
setPrintValue in interface PrintComponentvalue - the value objectpublic Object getPrintValue()
PrintComponent
getPrintValue in interface PrintComponent
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||