property change listener error with jtabbedpane
Greetings
I have a property change listener on my jtabbedpane (2 panes (index 0 of course and index 1). my problem is when i want to run my app it gives me a java null pointer exception. I believe it is b/c it is starting the app and it see the property change of the first tab at index 0 which is the first tab it sees and tries to run the method that makes the buttons visibility to true. but the buttons are already true. Basically how can I get the property change to run only after the app is visible? I made the buttons visibility false on startup to see if it can run the app but I still got the same error. I hope I am clear enough, if I am not please and I will attempt to reiterate the situation better. thanks for anyones help.
tabs =new JTabbedPane();
tabs.addChangeListener(this);
tabs.setPreferredSize(new java.awt.Dimension(800, 400));
tabs.addTab("Q", tab1.getMa());
tabs.addTab("R", tab2);
publicvoid stateChanged(ChangeEvent changeEvent){
JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource();
int index = sourceTabbedPane.getSelectedIndex();
//System.out.println("Tab changed to: " + sourceTabbedPane.getTitleAt(index)+" Index: "+index);
if (index==1){
changeButtonsF();
///makes buttons false on side panel
}
elseif (index==0){
changeButtonsT();
//makes buttons true on side panel
}
}

