Results 1 to 6 of 6

Thread: Confused about the List class

  1. #1
    Join Date
    Jan 2010
    Posts
    70

    Confused about the List class

    Hello Guys,

    I need your help to sort out my confusion about the List class of advanced java. In one my java project I have to use this List class. But I don't have enough knowledge about List class. If anyone posses sound knowledge about List class of java then please let me know the same. I would greatly appreciate your any help over List class of java.

  2. #2
    Join Date
    Apr 2008
    Posts
    2,005

    Re: Confused about the List class

    If an application wants to perform some action based on an item in this list being selected or activated by the user, it should implement ItemListener or ActionListener as appropriate and register the new listener to receive events from this list. For multiple-selection scrolling list class, it is considered a better user interface to use an external gesture (such as clicking on a button) to trigger the action.

  3. #3
    Join Date
    May 2008
    Posts
    2,012

    Re: Confused about the List class

    Hi friend,

    I hope something below will help you to know about the List class:
    Code:
    java.awt.List
    import java.util.ArrayList;
    
    public class ToArrayDM 
    {
      public static void main(String[] ankrgs) {
        List list01 = new ArrayList();
        list01.add("Blobbo");
        list01.add("Cracked");
        list01.add("Dumbo");
     
        Object[] ol1 = list01.toArray();
        System.out.println("Array of Object has length " + ol1.length);
       
        String[] sl01 = (String[]) list01.toArray(new String[0]);
        System.out.println("Array of String has length " + sl01.length);
      }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    1,948

    Re: Confused about the List class

    If you want to know about the methods of List class, then please go through the following:
    1. getPreferredSize(int rw)
    2. getListeners(Class listnrTp)
    3. delItems(int st, int ld)
    4. getMinimumSize(int rw)
    5. setMultipleSelections(boolean bl)

  5. #5
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Confused about the List class

    Please study following java code, which will solve your confusion about the List class:
    Code:
    java.awt.List
    
    public class ReverseTestSample
    {
      public static void main(String arbgs[])
     {
        ArrayList snl = new ArrayList();
        snl.add("Bart");
        snl.add("Hugo");
        snl.add("Lisa");
        snl.add("Marge");
        snl.add("Homer");
        snl.add("Maggie");
        snl.add("Roy");
     
       Comparator comp = Collections.reverseOrder();
        Collections.sort(snl);
        System.out.println(snl);
      }
    }

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Confused about the List class

    Hi,

    There are totally three constructors available with List class, see below:
    • List(int rw, boolean multipleMd): It is used for the creation of entirely new scrolling list with given number of rows.
    • List(): It is used for the creation of new scrolling list.
    • List(int rw): It is used for the creation of entirely new scrolling list with specific rows.

Similar Threads

  1. Confused about Scrollbar class
    By Jagruti23 in forum Software Development
    Replies: 5
    Last Post: 06-03-2010, 04:18 PM
  2. Confused with JInternalFrame class
    By Truster in forum Software Development
    Replies: 5
    Last Post: 17-02-2010, 09:58 AM
  3. Confused with JPopupMenu class
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 16-02-2010, 09:27 AM
  4. Confused with OverlayLayout class
    By Bottlenecked in forum Software Development
    Replies: 5
    Last Post: 12-02-2010, 09:37 AM
  5. Confused with 'Class SpinnerNumberModel'
    By Khan Baba in forum Software Development
    Replies: 5
    Last Post: 11-02-2010, 11:08 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,998,801.21486 seconds with 17 queries