com.samskivert.swing
Class LabelSausage

java.lang.Object
  extended by com.samskivert.swing.LabelSausage
Direct Known Subclasses:
RadialLabelSausage

public abstract class LabelSausage
extends Object

An abstract lightweight renderer that sizes and renders a label (with optional icon) in a roundy-ended sausage.


Field Summary
protected  int _dia
          The diameter of the circle that perfectly surrounds our icon.
protected  Icon _icon
          The optional icon.
protected  Label _label
          The label.
protected  int _lxoff
          The x offset for the label.
protected  int _lyoff
          The y offset for the label.
protected  Dimension _size
          The size of this label sausage.
protected  int _xoff
          The x offset of the icon.
protected  int _yoff
          The y offset of the icon.
 
Constructor Summary
protected LabelSausage(Label label, Icon icon)
          Constructs a label sausage.
 
Method Summary
protected  void drawBase(Graphics2D gfx, int x, int y)
          Draws the base sausage within which all the other decorations are added.
protected  void drawBorder(Graphics2D gfx, int x, int y)
          Draws the black outer border.
protected  void drawExtras(Graphics2D gfx, int x, int y, Object cliData)
          Draws any extras that may be required.
protected  void drawIcon(Graphics2D gfx, int x, int y, Object cliData)
          Draws the icon, if applicable.
protected  void drawLabel(Graphics2D gfx, int x, int y)
          Draws the label.
protected  void layout(Graphics2D gfx, int extraPadding)
          Lays out the label sausage.
protected  void layout(Graphics2D gfx, int iconPadding, int extraPadding)
          Lays out the label sausage.
protected  void paint(Graphics2D gfx, int x, int y, Color background, Object cliData)
          Paints the label sausage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_label

protected Label _label
The label.


_icon

protected Icon _icon
The optional icon.


_size

protected Dimension _size
The size of this label sausage.


_dia

protected int _dia
The diameter of the circle that perfectly surrounds our icon.


_xoff

protected int _xoff
The x offset of the icon.


_yoff

protected int _yoff
The y offset of the icon.


_lyoff

protected int _lyoff
The y offset for the label.


_lxoff

protected int _lxoff
The x offset for the label.

Constructor Detail

LabelSausage

protected LabelSausage(Label label,
                       Icon icon)
Constructs a label sausage.

Method Detail

layout

protected void layout(Graphics2D gfx,
                      int extraPadding)
Lays out the label sausage. It is assumed that the desired label font is already set in the label.


layout

protected void layout(Graphics2D gfx,
                      int iconPadding,
                      int extraPadding)
Lays out the label sausage. It is assumed that the desired label font is already set in the label.

Parameters:
iconPadding - the number of pixels in the x direction to pad around the icon.

paint

protected void paint(Graphics2D gfx,
                     int x,
                     int y,
                     Color background,
                     Object cliData)
Paints the label sausage.


drawBase

protected void drawBase(Graphics2D gfx,
                        int x,
                        int y)
Draws the base sausage within which all the other decorations are added.


drawIcon

protected void drawIcon(Graphics2D gfx,
                        int x,
                        int y,
                        Object cliData)
Draws the icon, if applicable.


drawLabel

protected void drawLabel(Graphics2D gfx,
                         int x,
                         int y)
Draws the label.


drawBorder

protected void drawBorder(Graphics2D gfx,
                          int x,
                          int y)
Draws the black outer border.


drawExtras

protected void drawExtras(Graphics2D gfx,
                          int x,
                          int y,
                          Object cliData)
Draws any extras that may be required.



Copyright © 2000-2008 Michael Bayne. All Rights Reserved.