Hi,
i am trying to create List Box. I have tried different programs downloaded from internet but i am getting Xlint:unchecked warning.
G:\Zulfi\java prog\2015\gui\ListBox>javac ListBox1.java
Note: ListBox1.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
G:\Zulfi\java prog\2015\gui\ListBox>javac -Xlint:unchecked ListBox1.java
ListBox1.java:17: warning: [unchecked] unchecked call to JList(E[]) as a member
of the raw type JList
JList list = new JList(options);
^
where E is a type-variable:
E extends Object declared in class JList
1 warning
G:\Zulfi\java prog\2015\gui\ListBox>javac ListBox1.java
Note: ListBox1.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
G:\Zulfi\java prog\2015\gui\ListBox>type ListBox1.java
import java.awt.*;
import javax.swing.*;
public class ListBox1 extends Object{
public static void main(String[] args) {
JFrame frame = new JFrame("Test Frame");
frame.setSize(new Dimension(300,200));
frame.setLocation(100,100);
Container contentPane = frame.getContentPane();
JLabel label = new JLabel("HERE IS A LABEL");
contentPane.add(label, BorderLayout.NORTH);
JButton button = new JButton("BUTTON");
contentPane.add(button, BorderLayout.SOUTH);
String[] options = {"Option 1", "Option 2",
"Option 3"};
JList list = new JList(options);
contentPane.add(list, BorderLayout.CENTER);
frame.setVisible(true);
}
}
However, i have tried and the program is running. Some body please guide me.
Zulfi.