UNB/ CS/ David Bremner/ teaching/ java/ JListExample.java
import javax.swing.JList;
import java.util.Vector;
import javax.swing.DefaultListModel;
import javax.swing.JScrollPane;
public class JListExample extends DBFrame{

    public static void main(String [] args){
        JListExample f=new JListExample();

        String[] data={"hello", "goodbye", "are you still here?"};
        Vector vec=new Vector();

        JList arrayList=new JList(data);

        f.getContentPane().add(arrayList);

        f.setVisible(true);

        for (int i=1; i< 10; i++){
            vec.add("item "+i);
        }
        JList vecList=new JList(vec);
        f.getContentPane().add(vecList);


        DefaultListModel dataModel=new DefaultListModel();
        JList dynaList = new JList(dataModel);

        f.getContentPane().add(new JScrollPane(dynaList));
        
        f.setVisible(true);
        
        for (int i=0; i< 50; i++){
            dataModel.addElement("item "+i);
        }
        
        dataModel.removeElementAt(16);
    }
}
//