in A class when i click a button and that button returns the true or false . if true returned then Next Tab of JTabbedPane is enabled ,which is written in another class. It may Sound stupid but I've tried a lot. and it is continously giving Null Pointer exception. Here's my Code..
public class StepsForApply extends JPanel {
public JTabbedPane tab = new JTabbedPane();
PersonalDetails pd = new PersonalDetails();
int ch =1;
int a[]={0,1,2,3,4,5};
public StepsForApply()
{
setLayout(null);
setBounds(100, 100, 660, 300);
tab.add("Sourcing",new JPanel());
tab.add("Personal Details",pd);
tab.add("Income Details",new JPanel());
tab.add("Education Details", new JPanel());
tab.add("Liability Details",new JPanel());
tab.add("Experence Details", new JPanel());
tab.setBounds(0,0,700,300);
add(tab);
//disableAll(1);
for(int i=2;i<=a.length-1;i++)
{
tab.setEnabledAt(i, false);
}
if(pd.check()==true)
{
tab.setEnabledAt(2,true);
}
setVisible(true);
}
}
Here 's the Accessing Personal Details in a tab
public class PersonalDetails extends JPanel {
int response,response1;
int cooat;
private JTextField voterTxt;
public boolean checkstatus = false;
public PersonalDetails()
{
setLayout(null);
JButton btnSave = new JButton("Save");
btnSave.setBounds(29, 173, 89, 23);
add(btnSave);
voterTxt = new JTextField();
voterTxt.setBounds(137, 67, 86, 20);
add(voterTxt);
voterTxt.setColumns(10);
JLabel lblVoteridNo = new JLabel("VoterId No.");
lblVoteridNo.setBounds(29, 70, 94, 14);
add(lblVoteridNo);
btnSave.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cooat = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm",
JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
PersonalDetails.this.check();
}
});
}
'
public boolean check()
{
if (cooat == JOptionPane.NO_OPTION) {
voterTxt.requestFocus();
}
else
if(cooat==JOptionPane.YES_OPTION)
{
checkstatus = true;
return checkstatus;
}
return checkstatus;
}
}