Package com.jidesoft.swing
Interface Overlayable
- All Superinterfaces:
SwingConstants
- All Known Implementing Classes:
DefaultOverlayable
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.-
Field Summary
FieldsFields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.Gets the overlay component.int
getOverlayLocation
(JComponent component) Gets the overlay component location.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.
-
Field Details
-
CLIENT_PROPERTY_OVERLAYABLE
Client property. If a component has this property, the property will be an Overlayable. The component is the actual component of the Overlayable.- See Also:
-
-
Method Details
-
addOverlayComponent
Adds an overlay component to the center.- Parameters:
component
- the overlay component.
-
addOverlayComponent
Adds an overlay component at the specified location. The location could be one of the following values.- Parameters:
component
- the overlay component.location
- the overlay location.
-
addOverlayComponent
Adds an overlay component at the specified location. The location could be one of the following values.- Parameters:
component
- the overlay component.location
- the overlay location.index
- the overlay index. 0 means the first overlay component. -1 means the last overlay component.
-
removeOverlayComponent
Removes an overlay component that was added before.- Parameters:
component
-
-
getOverlayComponents
JComponent[] getOverlayComponents()Gets the overlay component.- Returns:
- the overlay component.
-
setOverlayLocation
Sets the overlay component location. The valid values are defined in SwingConstants. They are- Parameters:
location
- the overlay component location.
-
getOverlayLocation
Gets the overlay component location. If -1, it means the component doesn't exit.- Returns:
- the overlay component location.
-
getOverlayLocationInsets
Insets getOverlayLocationInsets()Gets the insets of the overlay component relative to the border of the component. This will affect the actual location of the overlay component except CENTER. If an edge of the insets is greater than 0, it will move the overlay component outwards on that edge. On the opposite, if the value is negative, it will move inward.- Returns:
- the insets of the overlay component relative to the border of the component.
-
setOverlayLocationInsets
Sets the insets of the overlay component relative to the border of the component.- Parameters:
insets
- the insets of the overlay component relative to the border of the component.
-
setOverlayVisible
void setOverlayVisible(boolean visible) Sets all the overlay components visible or invisible. If you want to set one overlay component visible/invisible, you just need to call setVisible of that component.- Parameters:
visible
- true to set it visible. False to invisible.
-