This section illustrates you how to create a list of certain items using the Standard Widget Toolkit
In this example, we have create a list of certain items using SWT that provides the class List of package org.eclipse.swt.widgets to create the list in Java language.
The style SWT.MULTI provided by the List class is used to select multiple items from the list. The method list.add() adds the array to the list and the method list.getSelectionIndex() returns the index of selected item. Go through the below given example code that illustrates, how to create list of items in Java.
Here is the code of ListExample.java
Output will be displayed as:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.