Java JLayeredPane

The JLayeredPane class is used to add depth to swing container. It is used to provide a third dimension for positioning component and divide the depth-range into several different layers.


JLayeredPane class declaration

Commonly used Constructors:

ConstructorDescription
JLayeredPaneIt is used to create a new JLayeredPane

Commonly used Methods:

MethodDescription
int getIndexOf(Component c)It is used to return the index of the specified Component.
int getLayer(Component c)It is used to return the layer attribute for the specified Component.
int getPosition(Component c)It is used to return the relative position of the component within its layer.

Java JLayeredPane Example

Output:

Java Jlayeredpane 1



Latest Courses