-2
this is my code
package pack;
import java.awt.*;
import javax.swing.*;
public class MySwing
{
MySwing()
{

    JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame("This is my Frame");
JTabbedPane jtb= new JTabbedPane();
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();jtb.addTab("employee Info", p1);
jtb.addTab("employee Dept", p2); jtb.addTab("employee Salary", p3);
f.add(jtb);
JLabel l = new JLabel("User Name");
l.setForeground(Color.blue);
JTextField tf = new JTextField(20); tf.setFont(new Font("Coronet",Font.BOLD,20));
tf.setHorizontalAlignment(JTextField.RIGHT); tf.setBackground(Color.black);
tf.setForeground(Color.yellow);
JLabel l1 = new JLabel("Password: ");
JPasswordField pf = new JPasswordField(20);
JTextArea ta = new JTextArea(10,20);
JScrollPane sp = new JScrollPane(ta); 
String str[]={"select the city","Noida","Delhi","Faridabad"};
JComboBox c= new JComboBox(str);
JList li = new JList(str);
JCheckBox cb1= new JCheckBox("I.Sc",true);
JCheckBox cb2= new JCheckBox("B.Sc"); JCheckBox cb3= new JCheckBox("M.Sc");

    ButtonGroup cbg = new ButtonGroup(); JRadioButton cb4= new JRadioButton("Male",true);
JRadioButton cb5= new JRadioButton("Female",false);
cbg.add(cb4);cbg.add(cb5);
JButton b = new JButton("save");
p1.add(l);p1.add(tf);p1.add(l1);p1.add(pf);p2.add(sp);p2.add(c);p2.add(li);p2.add(cb1);p2.add(cb2);p2.add(cb3);
p3.add(cb4);p3.add(cb5);p3.add(b);
f.setSize(600,400); f.setLocation(200,100);
f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String arg[])
{

    new MySwing();
}
}

here this is the issue MySwing.java uses unchecked or unsafe operations recompile with -xlint:unchecked for details help me to resolve this this is not a error but my system doesn't run it resolve it

  • [What does Google have to say](https://www.google.com.au/search?q=uses+unchecked+or+unsafe+operations+recompile+with+-xlint%3Aunchecked&oq=uses+unchecked+or+unsafe+operations+recompile+with+-xlint%3Aunchecked&aqs=chrome..69i57.522j0j7&sourceid=chrome&ie=UTF-8) – MadProgrammer Jun 08 '17 at 08:24
  • https://stackoverflow.com/questions/23749786/uses-unchecked-or-unsafe-operations/23749904 – Scary Wombat Jun 08 '17 at 08:25

1 Answers1

1

For a start you can do

JComboBox<String> c= new JComboBox<String> (str);
JList<String> li = new JList<String>(str);

Learn about generics

Scary Wombat
  • 44,617
  • 6
  • 35
  • 64