public class Test {
public static void main(String[] args) {
try{
JTabbedPane tab = new JTabbedPane();
tab.removeChangeListener(null);
}catch(Exception e){
e.printStackTrace();
}
}
}
this doesn't result in a NullPointerException.
what exactly happens when I call tab.removeChangeListener(null)?
exactly this:
in JTabbedPane this method is invoked:
where the
listenerListis declared asprotected EventListenerList listenerList = new EventListenerList();and the remove method is:
so, removing a null is just returning leaving the listener unaffected