public interface Overlayable
extends javax.swing.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 java.lang.String |
CLIENT_PROPERTY_OVERLAYABLE
Client property.
|
Modifier and Type | Method and Description |
---|---|
void |
addOverlayComponent(javax.swing.JComponent component)
Adds an overlay component to the center.
|
void |
addOverlayComponent(javax.swing.JComponent component,
int location)
Adds an overlay component at the specified location.
|
void |
addOverlayComponent(javax.swing.JComponent component,
int location,
int index)
Adds an overlay component at the specified location.
|
javax.swing.JComponent[] |
getOverlayComponents()
Gets the overlay component.
|
int |
getOverlayLocation(javax.swing.JComponent component)
Gets the overlay component location.
|
java.awt.Insets |
getOverlayLocationInsets()
Gets the insets of the overlay component relative to the border of the component.
|
void |
removeOverlayComponent(javax.swing.JComponent component)
Removes an overlay component that was added before.
|
void |
setOverlayLocation(javax.swing.JComponent component,
int location)
Sets the overlay component location.
|
void |
setOverlayLocationInsets(java.awt.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 java.lang.String CLIENT_PROPERTY_OVERLAYABLE
void addOverlayComponent(javax.swing.JComponent component)
component
- the overlay component.void addOverlayComponent(javax.swing.JComponent component, int location)
SwingConstants.CENTER
SwingConstants.SOUTH
SwingConstants.NORTH
SwingConstants.WEST
SwingConstants.EAST
SwingConstants.NORTH_EAST
SwingConstants.NORTH_WEST
SwingConstants.SOUTH_EAST
SwingConstants.SOUTH_WEST
component
- the overlay component.location
- the overlay location.void addOverlayComponent(javax.swing.JComponent component, int location, int index)
SwingConstants.CENTER
SwingConstants.SOUTH
SwingConstants.NORTH
SwingConstants.WEST
SwingConstants.EAST
SwingConstants.NORTH_EAST
SwingConstants.NORTH_WEST
SwingConstants.SOUTH_EAST
SwingConstants.SOUTH_WEST
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(javax.swing.JComponent component)
component
- javax.swing.JComponent[] getOverlayComponents()
void setOverlayLocation(javax.swing.JComponent component, int location)
SwingConstants.CENTER
SwingConstants.SOUTH
SwingConstants.NORTH
SwingConstants.WEST
SwingConstants.EAST
SwingConstants.NORTH_EAST
SwingConstants.NORTH_WEST
SwingConstants.SOUTH_EAST
SwingConstants.SOUTH_WEST
location
- the overlay component location.int getOverlayLocation(javax.swing.JComponent component)
java.awt.Insets getOverlayLocationInsets()
void setOverlayLocationInsets(java.awt.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.