- /*
- Set Multiple Selection Mode For AWT List Example
- This java example shows how to set multiple selection mode for a list
- using Java AWT List class.
- */
- import java.applet.Applet;
- import java.awt.Graphics;
- import java.awt.List;
- /*
- <applet code="SetMultiSelectModeExample" width=200 height=200>
- </applet>
- */
- public class SetMultiSelectModeExample extends Applet{
- List list = null;
- public void init(){
- //create a single selection list
- list = new List(5);
- //add items
- 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 set multiple selection mode for a list, use
- * void setMultipleMode(boolean mode)
- * method.
- */
- list.setMultipleMode(true);
- }
- public void paint(Graphics g){
- g.drawString("Is Multiple Selection Allowed? " + list.isMultipleMode(), 10, 120);
- }
- }
Friday, 9 September 2016
Set Multiple Selection Mode For AWT List Example
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment