borland Packages  Class Hierarchy  jbcl.view Package  Index 

CompositeItemPainter component

java.lang.Object
   +----borland.jbcl.view.CompositeItemPainter

About the CompositeItemPainter component

Variables  Constructors  Properties  Methods  

Implements ItemPainter, Serializable

The CompositeItemPainter class paints items in a control, for items that have both an image and a string, such as in a tree. It delegates all painting to its two item painters.

See also: CompositeItemEditor.


CompositeItemPainter variables

Variables implemented in this class

CompositeItemPainter constructors

CompositeItemPainter properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.lang.Object

CompositeItemPainter methods

Methods implemented in this class

Methods implemented in java.lang.Object


CompositeItemPainter variables

alignment

  protected int alignment

background

  protected Color background

firstPainter

  protected transient ItemPainter firstPainter

gap

  protected int gap

margins

  protected Insets margins

orientation

  protected int orientation

paintBackground

  protected boolean paintBackground

secondPainter

  protected transient ItemPainter secondPainter

CompositeItemPainter constructors

CompositeItemPainter()

  public CompositeItemPainter()
Constructs a CompositeItemPainter.

CompositeItemPainter(borland.jbcl.model.ItemPainter, borland.jbcl.model.ItemPainter)

  public CompositeItemPainter(borland.jbcl.model.ItemPainter firstPainter, borland.jbcl.model.ItemPainter secondPainter)
Constructs a CompositeItemPainter with the specified item painters. The orientation is horizontal, the alignment is Alignment.CENTER | Alignment.MIDDLE, and the gap between the painters is 4 pixels.

Parameters:

firstPainter
The item painter for painting the first item of the item pair.
secondPainter
The item painter for painting the second item of the item pair.

CompositeItemPainter(borland.jbcl.model.ItemPainter, borland.jbcl.model.ItemPainter, int)

  public CompositeItemPainter(borland.jbcl.model.ItemPainter firstPainter, borland.jbcl.model.ItemPainter secondPainter, int orientation)
Constructs a CompositeItemPainter with the specified item painters and the specified orientation. The alignment is Alignment.CENTER | Alignment.MIDDLE, and the gap between the painters is 4 pixels.

Parameters:

firstPainter
The item painter for painting the first item of the item pair.
secondPainter
The item painter for painting the second item of the item pair.
orientation
Specify either Orienation.HORIZONTAL or Orientation.VERTICAL.

CompositeItemPainter(borland.jbcl.model.ItemPainter, borland.jbcl.model.ItemPainter, int, int)

  public CompositeItemPainter(borland.jbcl.model.ItemPainter firstPainter, borland.jbcl.model.ItemPainter secondPainter, int orientation, int alignment)
Constructs a CompositeItemPainter with the specified item painters, the specified orientation, and the specified alignment. The gap between the painters is 4 pixels.

Parameters:

firstPainter
The item painter for painting the first item of the item pair.
secondPainter
The item painter for painting the second item of the item pair.
orientation
Specify either Orienation.HORIZONTAL or Orientation.VERTICAL.
alignment
Specify alignment using the borland.jbcl.util.Alignment constants.

CompositeItemPainter(borland.jbcl.model.ItemPainter, borland.jbcl.model.ItemPainter, int, int, int)

  public CompositeItemPainter(borland.jbcl.model.ItemPainter firstPainter, borland.jbcl.model.ItemPainter secondPainter, int orientation, int alignment, int gap)
Constructs a CompositeItemPainter with the specified item painters, orientation, alignment, and gap.

Parameters:

firstPainter
The item painter for painting the first item of the item pair.
secondPainter
The item painter for painting the second item of the item pair.
orientation
Specify either Orienation.HORIZONTAL or Orientation.VERTICAL.
alignment
Specify alignment using the borland.jbcl.util.Alignment constants.
gap
The distance between the two painters in pixels.

CompositeItemPainter properties

alignment

 public int getAlignment()
 public void setAlignment(int alignment)
Determines the alignment of the item being painted in the painters. Specify alignment using the borland.jbcl.util.Alignment constants.

background

 public Color getBackground()
 public void setBackground(java.awt.Color background)
The background property defines the default background color for the TextItemPainter. If the ItemPaintSite passed into the getPreferredSize() or paint() methods has a valid background color setting, it will override this one.

gap

 public int getGap()
 public void setGap(int gap)
Determines the distance in pixels between the two item painters. Specify the distance you want with the gap parameter.

margins

 public Insets getMargins()
 public void setMargins(java.awt.Insets margins)
Determines the margins around the items to be painted.

orientation

 public int getOrientation()
 public void setOrientation(int o)
Determines the orientation of the text painted with item painter. The possibilities are Orientation.HORIZONTAL or Orienation.VERTICAL, as defined in the borland.jbcl.util.Orientation class.

paintBackground

 public boolean isPaintBackground()
 public void setPaintBackground(boolean paintBackground)
Determines whether the background is painted before the text is drawn in the paint() method. If paintBackground is true, the background is painted; otherwise, the background is not painted.

painter1

 public ItemPainter getPainter1()
 public void setPainter1(borland.jbcl.model.ItemPainter firstPainter)
Determines the item painter used to the first item in the item pair.

painter2

 public ItemPainter getPainter2()
 public void setPainter2(borland.jbcl.model.ItemPainter secondPainter)
Determines the item painter used to paint second item in the item pair.

CompositeItemPainter methods

calculateRects(java.lang.Object, java.awt.Graphics, java.awt.Rectangle, int, borland.jbcl.model.ItemPaintSite, java.awt.Rectangle, java.awt.Rectangle)

  public void calculateRects(java.lang.Object object, java.awt.Graphics graphics, java.awt.Rectangle rect, int state, borland.jbcl.model.ItemPaintSite site, java.awt.Rectangle rectFirst, java.awt.Rectangle rectSecond)
Uses the passed paint information (same parameters to paint) to calculate the ItemPainter rectangles, and fills in the passed rectangle's values.

Parameters:

object
The data object to use for calculations.
graphics
The Graphics object to use for calculations.
rect
The bounding Rectangle to use for calculations.
state
The current view state of the item.
rectFirst
The calculated rectangle of the first ItemPainter (filled in).
rectSecond
The calculated rectangle of the second ItemPainter (filled in).