public interface Overlayable extends SwingConstants
Overlayable
provides a way to add a number of components on top of another component as the overlay
components. Usually we make a component implementing Overlayable interface although it is not required. This
interface will allow user to add/remove other components as overlay components and set their location independently.Modifier and Type | Field and Description |
---|---|
static String |
CLIENT_PROPERTY_OVERLAYABLE
Client property.
|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Modifier and Type | Method and Description |
---|---|
void |
addOverlayComponent(JComponent component)
Adds an overlay component to the center.
|
void |
addOverlayComponent(JComponent component,
int location)
Adds an overlay component at the specified location.
|
void |
addOverlayComponent(JComponent component,
int location,
int index)
Adds an overlay component at the specified location.
|
JComponent[] |
getOverlayComponents()
Gets the overlay component.
|
int |
getOverlayLocation(JComponent component)
Gets the overlay component location.
|
Insets |
getOverlayLocationInsets()
Gets the insets of the overlay component relative to the border of the component.
|
void |
removeOverlayComponent(JComponent component)
Removes an overlay component that was added before.
|
void |
setOverlayLocation(JComponent component,
int location)
Sets the overlay component location.
|
void |
setOverlayLocationInsets(Insets insets)
Sets the insets of the overlay component relative to the border of the component.
|
void |
setOverlayVisible(boolean visible)
Sets all the overlay components visible or invisible.
|
static final String CLIENT_PROPERTY_OVERLAYABLE
void addOverlayComponent(JComponent component)
component
- the overlay component.void addOverlayComponent(JComponent component, int location)
component
- the overlay component.location
- the overlay location.void addOverlayComponent(JComponent component, int location, int index)
component
- the overlay component.location
- the overlay location.index
- the overlay index. 0 means the first overlay component. -1 means the last overlay component.void removeOverlayComponent(JComponent component)
component
- JComponent[] getOverlayComponents()
void setOverlayLocation(JComponent component, int location)
location
- the overlay component location.int getOverlayLocation(JComponent component)
Insets getOverlayLocationInsets()
void setOverlayLocationInsets(Insets insets)
insets
- the insets of the overlay component relative to the border of the component.void setOverlayVisible(boolean visible)
visible
- true to set it visible. False to invisible.