Results 1 to 7 of 7
  1. #1
    Bulelakes is offline Member
    Join Date
    Jul 2010
    Posts
    32
    Rep Power
    0

    Default Transfering all items from one List to another

    List queryResltList = new List();
    List actionListList= new List();


    //i can transfer one item :
    //transfering from queryResltList to actionListList.

    but now i want all items to be moved from one List to another by clicking the button.


    if (e.getSource()==buttonname)
    {
    queryResltList.add(actionListList.getSelectedItem( ));
    actionListList.remove(actionListList.getSelectedIn dex());

    }
    else if(e.getSource==buttonname)
    {

    // i need help here to transfer all items without selection.


    }
    Last edited by Bulelakes; 08-19-2010 at 02:58 PM. Reason: i used wrong statement

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Location
    Canada
    Posts
    684
    Rep Power
    5

    Default

    not really database related,

    Java Code:
      queryResltList.addAll(actionListList);
      actionListList.clear();

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #5
    Bulelakes is offline Member
    Join Date
    Jul 2010
    Posts
    32
    Rep Power
    0

    Default

    The addAll method is not supported by netbeans so it doesn't work still!!

  6. #6
    Bulelakes is offline Member
    Join Date
    Jul 2010
    Posts
    32
    Rep Power
    0

    Smile

    Thank u so much for trying to help me finally i got it right below is my code


    Java Code:
    if (e.getSource()==cpyallrytBtn)
               {
    
                int i =queryResltList.getSelectedIndex();
                 String items[];
                 while(i==-1)
                  {
                         
                       items =(String[]) queryResltList.getItems();
    
                    for(int j=0;j<items.length;j++){
                        
                          actionListList.add(items[j]);
                          queryResltList.removeAll();
                    }
                          break;
    
                   }

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,352
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Bulelakes View Post
    The addAll method is not supported by netbeans so it doesn't work still!!
    NetBeans has nothing to do with it; if a class or method is available (maybe through the classpath value) it is available in NetBeans. It is an IDE for Pete's sake, not a magician.

    kind regards,

    Jos

Similar Threads

  1. Transfering Focus
    By kevh in forum AWT / Swing
    Replies: 0
    Last Post: 07-30-2010, 06:12 PM
  2. List of Items in JTextArea
    By ŖΫ ỏ Ңόρę in forum New To Java
    Replies: 7
    Last Post: 03-15-2010, 09:03 PM
  3. Replies: 0
    Last Post: 02-26-2009, 08:14 PM
  4. Replies: 8
    Last Post: 12-29-2008, 07:12 AM
  5. Transfering files over HTTP
    By DannyZB in forum Networking
    Replies: 16
    Last Post: 11-09-2008, 09:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •