0

This is my program for Biodata in applet using JFrame

import javax.swing.*;
import java.awt.*;

public class Biodata extends JFrame
{
JLabel jlname,jladd,jlmobno,jldob,jlgender,jltab,jlhob,jllang;
JTextField jtname,jtmobno;
JTextArea jtadd;
JComboBox jcd,jcm,jcy;
JRadioButton jrm,jrf;
ButtonGroup bg;
JTable jtedu;
JScrollPane jsp,jshob;
JList jlhobby;
JCheckBox jc1,jc2,jc3;
JButton jb1,jb2;
JPanel jpr,jpcombo,jpcheck;
JFrame jf;
Biodata()
{
jf=new JFrame("Biodata");
jpr=new JPanel();
jf.setSize(500,500);
jf.setLayout(new GridLayout(9,2));
jlname=new JLabel("Enter Name : ");
jladd=new JLabel("Enter Address : ");
jlmobno=new JLabel("Enter Mobile No. : ");
jldob=new JLabel("DOB : ");
jlgender=new JLabel("Choose Gender : ");
jltab=new JLabel("Education details : ");
jlhob=new JLabel("Hobby : ");
jllang=new JLabel("Choose Language : ");
jtname=new JTextField(10);
jtmobno=new JTextField(10);
jcd=new JComboBox();
int i=1;
while(i<32)
{
    Integer i1=new Integer(i);
    String s=i1.toString();
    jcd.addItem(s);
    i++;
}
jcm=new JComboBox();
i=1;
while(i<13)
{
    Integer i1=new Integer(i);
    String s=i1.toString();
    jcm.addItem(s);
    i++;
}
jcy=new JComboBox();
i=1900;
while(i<2005)
{
    Integer i1=new Integer(i);
    String s=i1.toString();
    jcy.addItem(s);
    i++;
}
jtadd=new JTextArea(10,10);
jpcombo=new JPanel();
jrm=new JRadioButton("Male");
jrf=new JRadioButton("Female");
bg=new ButtonGroup();
bg.add(jrm);
bg.add(jrf);
Object cols[]={"Year","Degree","Percentage"};
Object data[][]={{"2010","SSC","90%"},{"2012","HSC","90%"},{"2015","BScIT","90%"}};
jtedu=new JTable(data,cols);
jsp=new JScrollPane(jtedu);
Object listdata[]={"Cricket","Football","Tennis","Reading","Chess","Volleyball"};
jlhobby=new JList(listdata);
jshob=new JScrollPane(jlhobby);
jc1=new JCheckBox("Marathi");
jc2=new JCheckBox("Hindi");
jc3=new JCheckBox("English");
jpcheck=new JPanel();
jb1=new JButton("Submit");
jb2=new JButton("Reset");
jf.add(jlname);
jf.add(jtname);
jf.add(jladd);
jf.add(jtadd);
jf.add(jlmobno);
jf.add(jtmobno);
jf.add(jldob);
jpcombo.add(jcd);
jpcombo.add(jcm);
jpcombo.add(jcy);
jf.add(jpcombo);
jpr.add(jrm);
jpr.add(jrf);
jf.add(jlgender);
jf.add(jpr);
jf.add(jltab);
jf.add(jsp);
jf.add(jlhob);
jf.add(jshob);
jpcheck.add(jc1);
jpcheck.add(jc2);
jpcheck.add(jc3);
jf.add(jllang);
jf.add(jpcheck);
jf.add(jb1);
jf.add(jb2);
jf.setVisible(true);
jf.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
public static void main(String args[])
{
    new Biodata();
}
}

Following is shown if -Xlint is done

D:\java\jclg>javac Biodata.java -Xlint
Biodata.java:9: warning: [rawtypes] found raw type: JComboBox
JComboBox jcd,jcm,jcy;
^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:9: warning: [rawtypes] found raw type: JComboBox
JComboBox jcd,jcm,jcy;
^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:9: warning: [rawtypes] found raw type: JComboBox
JComboBox jcd,jcm,jcy;
^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:14: warning: [rawtypes] found raw type: JList
JList jlhobby;
^
  missing type arguments for generic class JList<E>
  where E is a type-variable:
    E extends Object declared in class JList
Biodata.java:35: warning: [rawtypes] found raw type: JComboBox
jcd=new JComboBox();
        ^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:41: warning: [unchecked] unchecked call to addItem(E) as a member o
f the raw type JComboBox
        jcd.addItem(s);
                   ^
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:44: warning: [rawtypes] found raw type: JComboBox
jcm=new JComboBox();
        ^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:50: warning: [unchecked] unchecked call to addItem(E) as a member o
f the raw type JComboBox
        jcm.addItem(s);
                   ^
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:53: warning: [rawtypes] found raw type: JComboBox
jcy=new JComboBox();
        ^
  missing type arguments for generic class JComboBox<E>
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:59: warning: [unchecked] unchecked call to addItem(E) as a member o
f the raw type JComboBox
        jcy.addItem(s);
                   ^
  where E is a type-variable:
    E extends Object declared in class JComboBox
Biodata.java:74: warning: [rawtypes] found raw type: JList
jlhobby=new JList(listdata);
            ^
  missing type arguments for generic class JList<E>
  where E is a type-variable:
    E extends Object declared in class JList
Biodata.java:74: warning: [unchecked] unchecked call to JList(E[]) as a member o
f the raw type JList
jlhobby=new JList(listdata);
        ^
  where E is a type-variable:
    E extends Object declared in class JList
Biodata.java:4: warning: [serial] serializable class Biodata has no definition o
f serialVersionUID
public class Biodata extends JFrame
       ^
13 warnings

I have did several programs using swing & found those warning various times.
Finally I thought that I have to ask it here to understand what actually this warnings are there.
Still it is not actually affecting the output but Is there anyway to solve this problem?

2
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by vinnitro
0

Thanx for help but what about this

Biodata.java:4: warning: [serial] serializable class Biodata has no definition o
f serialVersionUID
public class Biodata extends JFrame
       ^

how to solve this???
This is only the thing remained now

1

Better check the documentations for these warnings.
http://docs.oracle.com/javase/7/docs/api/javax/swing/JFrame.html

This error is because of serializable class. You have two ways to eliminate this

1) Give it a ID
private static final long serialVersionUID = any_Id;

2) If you using eclipse then use
@SuppressWarnings("serial") // this anotation will disable the warning because of serial.

Votes + Comments
thnx for helping it worked
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.