public class Surround extends Object
Surround.Block
is attached to each side of the rectangle.
This does a somewhat similar job to Insets
,
but provides more detail about what's happening at the corners.
Modifier and Type | Class and Description |
---|---|
static class |
Surround.Block
Represents the space taken along one side of a rectangle.
|
Modifier and Type | Field and Description |
---|---|
Surround.Block |
bottom |
Surround.Block |
left |
Surround.Block |
right |
Surround.Block |
top |
Constructor and Description |
---|
Surround()
Constructs a new Surround with no reserved space.
|
Surround(Surround.Block top,
Surround.Block left,
Surround.Block bottom,
Surround.Block right)
Constructs a surround with provided blocks.
|
Surround(Surround other)
Clone constructor.
|
Modifier and Type | Method and Description |
---|---|
Surround |
add(Surround other)
Adds another surround to this one.
|
boolean |
addExternalRectangle(Rectangle inner,
Rectangle addBox)
Extends this surround by a given rectangle assumed to be attached
to one of the edges of a supplied inner rectangle.
|
static Surround |
fromInsets(Insets insets)
Creates a Surround from an Insets.
|
Rectangle[] |
getRegions(Rectangle inner)
Returns an array of four rectangles giving the areas described
by this object as applied to a given inner rectangle.
|
Insets |
toExtentInsets()
Returns an Insets object representing only the space corresponding
to the Extent parts of this Surround.
|
Insets |
toInsets()
Returns an Insets object representing all the space reserved
by this Surround.
|
String |
toString() |
Surround |
union(Surround other)
Returns a new surround that represents the union of the areas
represented by this one and a supplied one.
|
public Surround.Block top
public Surround.Block left
public Surround.Block bottom
public Surround.Block right
public Surround()
public Surround(Surround other)
other
- templatepublic Surround(Surround.Block top, Surround.Block left, Surround.Block bottom, Surround.Block right)
top
- block for top sideleft
- block for left sidebottom
- block for bottom sideright
- block for right sidepublic Insets toInsets()
public Insets toExtentInsets()
public Rectangle[] getRegions(Rectangle inner)
inner
- inner rectanglepublic boolean addExternalRectangle(Rectangle inner, Rectangle addBox)
inner
- inner rectangleaddBox
- external box to add to this surroundpublic Surround add(Surround other)
other
- surround to add to this onepublic Surround union(Surround other)
other
- other surroundCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.