Hi there aveshn.
It seams you dont have much experience with GUI Developing with Java Swing. So i advise to take a look on a Java Swing Tutorial, for instance one of the Sun. here you have a URL:
http://java.sun.com/docs/books/tutorial/uiswing/
any way i leave you here a piece of code to create a JList that have to be added on a JPanel.
public class JListExample extends JFrame {
private JList list;
private JPanel listPanel;
private JScrollPane scroll;
private DefaultListModel listModel;
public JListExample() {
super("GUJ - JList");
listModel = new DefaultListModel();
listPanel = new JPanel();
// adding items to the JList
listModel.addElement("Item 1");
listModel.addElement("Item 2");
listModel.addElement("Item 3");
//configuring the JList with listModel
list = new JList(listModel);
list.setVisibleRowCount(3);
scroll = new JScrollPane(lista);
listPanel.add(scroll);
getContentPane().add(listPanel, BorderLayout.CENTER);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// show the window
pack();
setVisible(true);
}
public static void main(String args[]){
JListExample jListExample = new JListExample();
}
}
Hope this tip was useful. Anyway this is not a GUI forum. You would find more helpfull to use a GUI forum.
See ya later. Dont forget to rate
--ms