List Assignment Help

Assignment Help: >> Controls and Events - List

List:

The List class implements a scrollable list of text items.  Because the list is scrollable the number of items which could be visible in the list box is declared as the number of rows in the list. A list could be of course having any number of text items and a scroll bar appears whenever necessary to scroll the list.

A List object could be created using one of the following constructors, along with options for specifying the number of rows and multiple selection modes

List ( )

List (int rows)

List (int rows, boolean multipleMode) Constructing a list includes the below given steps.

1. Creating a List object, optionally specifying the number of rows and multiple selection modes.

2. Adding the items using add ( ) method. The items are strings.

a. void add(String item)

b. void add(String item, int index)

Several accessor methods are declared for scrollbar lists:

2402_list.png

The List class declares methods for inserting, changing and removing items.

// Illustrating List

import java.awt.*;

import java.applet.*;

public class ListApplet extends Applet

{

public void init ( )

{

String [ ] fruit = {"Mango", "Pineapple","Bannana", "Pawpaw");

List fruitList = new List(fruit.length -1, true);

for(int i = 0; i<fruit.length; i++){

fruitList.add(fruit[i]);

}

add(fruitList);

}

}

163_list1.png

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd