/*
Make Item Of AWT List Visible Example
This java example shows how to make an item of a AWT List visible
using Java AWT List class.
*/
import java.applet.Applet;
import java.awt.List;
/*
<applet code="MakeItemVisibleExample" width=200 height=200>
</applet>
*/
public class MakeItemVisibleExample extends Applet{
List list = null;
public void init(){
//create a list with 5 visible rows
list = new List(5, true);
//add items to a list
list.add("One");
list.add("Two");
list.add("Three");
list.add("Four");
list.add("Five");
list.add("Six");
list.add("Seven");
//add list
add(list);
/*
* To make an item of a list visible, use
* void makeVisible(int index)
* method.
*
* Due to limited number of visible rows, certain rows of a list
* will not be visible. Use this method to make an item visible.
*/
list.makeVisible(6);
}
}
Example Output

Bookmark/Search this post with: