2

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?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Nathan Lam
  • 19
  • 4
  • can you check this [link](https://docs.oracle.com/javase/7/docs/api/javax/swing/JLayeredPane.html) You can see the structure and how to remove it. – eisbach Apr 23 '17 at 00:36
  • The most important is the Java code that you try. So we need that code to help you. Otherwise, it seem that you are asking for someone to write some code for you. Stack Overflow is a question and answer site, not a code-writing service. Please check these links to learn [How to write effective questions](https://stackoverflow.com/help/how-to-ask) or [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve). – Teocci Apr 23 '17 at 04:54
  • I created this solution based on [the documentation of JLayeredPane](https://docs.oracle.com/javase/7/docs/api/javax/swing/JLayeredPane.html). Please, [check this code](https://gist.github.com/teocci/6bbd67f3bc28822f52958d5a7dee3db0) and if is what you need let me know and I will post it as the answer. – Teocci Apr 23 '17 at 08:11

1 Answers1

4
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

mahdi
  • 184
  • 11