You're having a context problem.
First you create an instance variable of SRLSearchPanel
private SRLSearchPanel panel = new SRLSearchPanel();
This is used by your FilterBox
But then you create another instance...
SRLSearchPanel spanel = new SRLSearchPanel();
frame.add(spanel);
This is the one that is actually on the screen, so interacting with panel
has no effect as it has no relationship to what you've actually put on the screen
Instead, you could try simply requesting that the FilterBox
be removed from it's parent...
closeBtn.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
getParent().remove(FilterBox.this);
}
});