Results 1 to 7 of 7
  1. #1
    basset1991 is offline Member
    Join Date
    Dec 2013
    Posts
    4
    Rep Power
    0

    Default Program Add & Delete element of list

    Salem I want someone who can help me to make a little program (the Last Time Tomorrow) program details:
    It has a list contains elements and was therefore a writing space if you want to write and press the "Add" button the word cried Adding directly to the list When you click an item in the list and was pressing the "Delete" button will delete the item it from the list
    Photo and it can provide information on the Program
    Program Add & Delete element of  list-ajoute-supprimer-un-element-une-liste.jpg

  2. #2
    basset1991 is offline Member
    Join Date
    Dec 2013
    Posts
    4
    Rep Power
    0

    Default Re: Program Add & Delete element of list

    Some One Help me Please

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

    Default Re: Program Add & Delete element of list

    Please post the code you are having problems with and ask some questions about your problems.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    basset1991 is offline Member
    Join Date
    Dec 2013
    Posts
    4
    Rep Power
    0

    Default Re: Program Add & Delete element of list

    Quote Originally Posted by Norm View Post
    Please post the code you are having problems with and ask some questions about your problems.
    Java Code:
    import java.awt.* ;
    import java.awt.event.* ;
    import javax.swing.* ;
    import javax.swing.event.* ;   // utile pour ListSelectionListener
    
    class FenList extends JFrame implements ListSelectionListener
    { public FenList ()
      { setTitle ("Essais boite de liste") ;
        setSize (300, 160) ;
        Container contenu = getContentPane() ;
        contenu.setLayout (new FlowLayout() ) ;
        liste = new JList (couleurs) ;
        contenu.add(liste) ;
        liste.addListSelectionListener (this) ;
        liste.setVisibleRowCount(3);
        JScrollPane def = new JScrollPane(liste);
        contenu.add(def);
      }
      public void valueChanged (ListSelectionEvent e)
      { if (!e.getValueIsAdjusting())
        { System.out.println ("**Action Liste - valeurs selectionnees :") ;
          Object[] valeurs = liste.getSelectedValues() ;
          for (int i = 0 ; i<valeurs.length ; i++)
            System.out.println ((String) valeurs[i]) ;
        }
      }
      private String[] couleurs = {"rouge", "bleu", "gris", "vert", "jaune", "noir" } ;
      private JList liste ;
    }
    
    public class Liste
    { public static void main (String args[])
      { FenList fen = new FenList() ;
        fen.setVisible(true) ;
      }
    }
    Last edited by basset1991; 12-14-2013 at 07:44 PM.

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

    Default Re: Program Add & Delete element of list

    What problems and questions do you have about that code?

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    Also the formatting of the code needs some work.. There should NOT be any code on the same line following a {
    or before a }.
    Last edited by Norm; 12-14-2013 at 06:57 PM.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    basset1991 is offline Member
    Join Date
    Dec 2013
    Posts
    4
    Rep Power
    0

    Default Re: Program Add & Delete element of list

    If You Can Please Help me

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

    Default Re: Program Add & Delete element of list

    What problems and questions do you have about that code?

    The formatting of the code needs some work.. There should NOT be any code on the same line following a { (see line 7 and 8).
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. How to pop the element of stack to a list?
    By hjxlpp in forum Advanced Java
    Replies: 3
    Last Post: 07-14-2013, 01:10 PM
  2. how to delete an element from a sorted array
    By gnawk in forum New To Java
    Replies: 2
    Last Post: 07-12-2012, 09:48 PM
  3. last element of recursive list
    By rokko in forum New To Java
    Replies: 21
    Last Post: 04-02-2012, 05:14 PM
  4. Delete Middle element from arrray
    By tttestall in forum New To Java
    Replies: 3
    Last Post: 04-24-2011, 07:25 PM
  5. Replies: 4
    Last Post: 02-21-2011, 09:34 AM

Posting Permissions

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