Sir,
I have a problem with Swings-JTabbedPane. When I want to add a ButtonGroup component (which has two JRadioButtons added to it) to a JPanel with add() i.e, jp.add(bg), it shows error. So ultimately I can not add the JPanel to the JTabbedPane. But when I add the JRadioButtons directly to the JPanel and in turn, JPanel to JTabbedPane then there is no compilation error but there is runtime error stating NullPointerException on the line marked with '?' mark.
b1=new JRadioButton("Married");
b2=new JRadioButton("Unmarried");
bg=new ButtonGroup();
bg.add(b1);
bg.add(b2);
jp=new JPanel();
jp.add(b1,b2);
c.add(jp);
jtp.addTab("MS",ii,jp,"Marital Status"); ???
jtp.setSize(250,250);
jf.getContentPane().add(jtp);
Please, help.