public class ComponentBorder extends Object implements Border
| Modifier and Type | Class and Description |
|---|---|
static class |
ComponentBorder.Edge |
| Modifier and Type | Field and Description |
|---|---|
static float |
CENTER |
static float |
LEADING |
static float |
TRAILING |
| Constructor and Description |
|---|
ComponentBorder(JComponent component)
Convenience constructor that uses the default edge (Edge.RIGHT) and
alignment (CENTER).
|
ComponentBorder(JComponent component,
ComponentBorder.Edge edge)
Convenience constructor that uses the default alignment (CENTER).
|
ComponentBorder(JComponent component,
ComponentBorder.Edge edge,
float alignment)
Main constructor to create a ComponentBorder.
|
| Modifier and Type | Method and Description |
|---|---|
float |
getAlignment()
Get the component alignment along the Border Edge
|
Insets |
getBorderInsets(Component c) |
ComponentBorder.Edge |
getEdge()
Get the Edge the component is positioned along
|
int |
getGap()
Get the gap between the border component and the parent component
|
void |
install(JComponent parent) |
boolean |
isAdjustInsets() |
boolean |
isBorderOpaque() |
void |
paintBorder(Component c,
Graphics g,
int x,
int y,
int width,
int height)
In this case a real component is to be painted.
|
void |
setAdjustInsets(boolean adjustInsets) |
void |
setAlignment(float alignment)
Set the component alignment along the Border Edge
|
void |
setEdge(ComponentBorder.Edge edge)
Set the Edge the component is positioned along
|
void |
setGap(int gap)
Set the gap between the border component and the parent component
|
public static final float LEADING
public static final float CENTER
public static final float TRAILING
public ComponentBorder(JComponent component)
component - the component to be added in the Border areapublic ComponentBorder(JComponent component, ComponentBorder.Edge edge)
component - the component to be added in the Border areaedge - a valid Edge enum of TOP, LEFT, BOTTOM, RIGHTpublic ComponentBorder(JComponent component, ComponentBorder.Edge edge, float alignment)
component - the component to be added in the Border areaedge - a valid Edge enum of TOP, LEFT, BOTTOM, RIGHTalignment - the alignment of the component along the
specified Edge. Must be in the range 0 - 1.0.public boolean isAdjustInsets()
public void setAdjustInsets(boolean adjustInsets)
public float getAlignment()
public final void setAlignment(float alignment)
alignment - a value in the range 0 - 1.0. Standard values would be
CENTER (default), LEFT and RIGHT.public ComponentBorder.Edge getEdge()
public final void setEdge(ComponentBorder.Edge edge)
edge - the Edge the component is position on.public int getGap()
public void setGap(int gap)
gap - the gap in pixels (default is 5)public Insets getBorderInsets(Component c)
getBorderInsets in interface Borderpublic boolean isBorderOpaque()
isBorderOpaque in interface Borderpublic void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
paintBorder in interface Borderpublic void install(JComponent parent)
Copyright © 2016. All rights reserved.