Java AWT Multi-Select List Example


Here is the screenshot of the sample AWT window, which we will create in this example:

In our example, we have a Multi-Select List box control in the upper left portion of the AWT Frame. When the user clicks the Get Fruits button, the AWT TextArea control will show all the selected list items in it. The Clear Output button will delete the text displayed in the AWT TextArea Control. This example will help you learn how to add strings on AWT List Control and how to retrieve all the items selected by the user. Now, we will proceed with the example.

Read More…

Java HashSet Class & Set Interface

Before we learn about Java hashSet class, we will learn about the Set interface. Because the HashSet class implements Java Collection’s Set interface. The Set Interface ensures the implementing class to hold uniqueness in the collection. Means, it does not allow duplicate items. In Java Collection framework, the below classes implement the Set interface:

1. HashSet
2. EnumSet
3. TreeSet

There were other classes as well. But here we listed frequently used ones. In this example, we will explore about the HashSet collection class.

Read More…