Page 2 :
1.3 AWT Controls and Layout Managers:, , , List:, , , , The List class provides a compact, multiple-choice,, scrolling selection list. Unlike the Choice object, which, shows only the single selected item in the menu, a List, , object can be constructed to show any number of choices, in the visible Window., , , It can also be created to allow multiple selections., , DJ Sir
Page 3 :
1.3 AWT Controls and Layout Managers:, , , List: Constructors, , , , List()-Creates a new scrolling list., , , , List(int rows)-Creates a new scrolling, list initialized with the specified number of visible lines., , , , List(int rows, boolean multipleMode)-Creates a new, scrolling list initialized to display the specified number, of rows., , DJ Sir
Page 4 :
1.3 AWT Controls and Layout Managers:, , , List: Methods, , , , void add(String item)-Adds the specified item to the, end of scrolling list., , , , void add(String item, int index)-Adds the specified, item to the scrolling list at the position indicated by the, , index., , DJ Sir
Page 5 :
1.3 AWT Controls and Layout Managers:, , , List: Methods, , , , int getItemCount()-Gets the number of items in the list., , , , String[] getItems()-Gets the items in the list., , , , int getSelectedIndex()-Gets the index of the selected, item on the list., , , , int[] getSelectedIndexes()-Gets the selected indexes on, , the list., DJ Sir
Page 6 :
1.3 AWT Controls and Layout Managers:, , , List: Methods, , , , String getSelectedItem()-Gets the selected item on this, scrolling list., , , , String[] getSelectedItems()-Gets the selected items on, this scrolling list., , , , void removeAll()-Removes all items from this list., , DJ Sir
Page 7 :
1.3 AWT Controls and Layout Managers:, , , List: Methods, , , , void remove(int position)-Removes the item at the, specified position from this scrolling list., , , , void remove(String item)-Removes the first occurrence, of an item from the list., , , , int getRows()-Gets the number of visible lines in this, list., , DJ Sir
Page 8 :
1.3 AWT Controls and Layout Managers:, , , List: Methods, , , , void select(int index)-Selects the item at the specified, index in the scrolling list., , , , void deselect(int index)-Deselects the item at the, specified index., , , , String getItem(int index)-Gets the item associated with, the specified index., , DJ Sir
Page 9 :
1.3 AWT Controls and Layout Managers:, , , Handling List:, , , , To process list events, you will need to implement the, ActionListener interface., , , , Each time a List item is double-clicked, an ActionEvent, object is generated. Its getActionCommand( ) method, can be used to retrieve the name of the newly selected, , item., DJ Sir
Page 10 :
1.3 AWT Controls and Layout Managers:, , , Handling List:, , , , Also, each time an item is selected or deselected with a, single click, an ItemEvent object is generated. Its, , getStateChange( ) method can be used to determine, whether a selection or deselection triggered this event., getItemSelectable( ) returns a reference to the object that, triggered this event., DJ Sir
Page 11 :
1.3 AWT Controls and Layout Managers:, , , List: Example, , DJ Sir