Nathan Lam
Nathan Lam

Reputation: 29

Deleting a layer in a JLayeredPane

I am currently working on a Java application that utilizes the JLayeredPane. I currently have 2 split panes in 2 different layers and I'm trying to remove one of the layers completely.

How do I accomplish this?

Upvotes: 3

Views: 1779

Answers (1)

mahdi
mahdi

Reputation: 182

void    remove(int index)

Removes the indexed component from this pane.

you can also use

remove(Component comp)

or

removeAll()

the last one if you want to remove all of layeres

also do

 panel.revalidate();
 panel.repaint();

to apply the changes.

for more help i shall see your code.

check https://docs.oracle.com/javase/7/docs/api/javax/swing/JLayeredPane.html

Upvotes: 3

Related Questions