public class CompoundBorder extends AbstractBorder
Modifier and Type | Field and Description |
---|---|
protected Border |
inner
The inner Border.
|
protected Border |
outer
The outer Border.
|
tempRect
Constructor and Description |
---|
CompoundBorder()
Constructs a default CompoundBorder with no borders under it.
|
CompoundBorder(Border outer,
Border inner)
Constructs a CompoundBorder with the two borders specified as input.
|
Modifier and Type | Method and Description |
---|---|
Border |
getInnerBorder()
Returns the inner border of this CompoundBorder.
|
Insets |
getInsets(IFigure figure)
Returns the total insets required to hold both the inner and outer
borders of this CompoundBorder.
|
Border |
getOuterBorder()
Returns the outer border of this CompoundBorder.
|
Dimension |
getPreferredSize(IFigure fig)
Returns the preferred width and height that this border would like to
display itself properly.
|
boolean |
isOpaque()
Returns
true if this border is opaque. |
void |
paint(IFigure figure,
Graphics g,
Insets insets)
Paints the border.
|
getPaintRectangle
protected Border inner
protected Border outer
public CompoundBorder()
public Border getInnerBorder()
public Insets getInsets(IFigure figure)
figure
- Figure for which this is the borderpublic Dimension getPreferredSize(IFigure fig)
Border
getPreferredSize
in interface Border
getPreferredSize
in class AbstractBorder
fig
- The figureBorder.getPreferredSize(IFigure)
public Border getOuterBorder()
public boolean isOpaque()
true
if this border is opaque. Return value is
dependent on the opaque state of both the borders it contains. Both
borders have to be opaque for this border to be opaque. In the absence of
any of the borders, this border is not opaque.isOpaque
in interface Border
isOpaque
in class AbstractBorder
true
if this border is opaqueBorder.isOpaque()
public void paint(IFigure figure, Graphics g, Insets insets)
Border
IFigure.getBounds()
, inset by the parameter insets. The
border generally should not paint inside its own insets. More
specifically, Border b should paint inside the rectangle:
figure.getBounds().getCropped(insets) and outside of the rectangle:
figure.getBounds().getCropped(insets).getCropped(getInsets()) where
inside is defined as Rectangle.contains(int, int)
.figure
- The figure this border belongs tog
- The graphics object used for paintinginsets
- The insetsBorder.paint(IFigure, Graphics, Insets)
Copyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.