Question: how to use jlist in java?
Answer: import javax.swing.*; public class ListExample. { ListExample(){ JFrame f= new JFrame(); DefaultListModel<String> l1 = new DefaultListModel<>(); l1.addElement("Item1"); l1.addElement("Item2");