I tried to add a event listener to a container like JTextPane , when before removed a component ,that I can check the component’s name and decide the component should be removed or not. I search the answer,there is a Container Listener ,it has the method componentRemoved,but it fired after component removed.so ,Any one has some solution?Any suggestion will be appreciated.
Share
I try StanislavL’s suggestion,and it worked on my target.
I defined a class to extend the container,and override the remove method,then judge the component’s name and decide it should be removed or not.