Java List The object of JList class represents a list of text items. The list of text items can be set up so that the user can choose either one item or multiple items. It inherits JComponent class. Lists can have many items, so they are often put in scrolls panes. Jlist is always associate with INDEXing . the first item you add will have index 0, second item having index 1, third item will having index 2 and so on. How to Create List Just Drag and Drop jlist from palette. How to add item in List Use model property from property window , as I already mentioned in combo box section. Another way to add tem in List is by using Default model. hear I am going to show you an example for this; import javax.swing.DefaultListModel; import javax.swing.JList; public class Main { public static void main(String[] argv) throws Exception { DefaultListModel model = new DefaultListModel(); ...
By Ruchita Agrawal