I have a model view controller application. The view contains a JXTaskContainer with several JXTaskPane. The JXTaskPane has a delete button that will remove it from the container.
How can I find the right JXTaskPane and then delete it from the container assuming the JXTaskpanes where all added automatically by clicking a button?
`enter code here`class Holder extends JFrame {
Arraylist <Section> sectionList = new ArrayList<Section>();
JPanel holderPanel = new JPanel;
JXTaskPaneContainer sectionContainer = new JXTaskPaneContainer();
this.add(holderPanel);
// here goes other stuff
class AddSectionAction implements ActionListener{
//actionPerformed
Section section = new Section();
section.addActionListener(new DeleteSectionAction);
sectionList.add(section);
sectionContainer.add(section);
holderPanel.add(sectionContainer);
holderPanel.revalidate();
holderPanel.repain();
}
class DeleteSectionAction implements ActionListener{
//actionPerformed
sectionContainer.remove(THE SECTION I WANT TO REMOVE );
}
}
public class Section extends JXTaskPane {
JTextArea textArea;
JButton deleteMe;
//other stuff here
public JButton getDeleteMe{
return deleteMe;
}
}