Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

1 Visitor Messages

  1. Hello friends..I am new to this forum .
    I am developing small application using NetBeans 7.0 which has a JList on the form from the palette . I am filling the JList using the vector which contains records from database. But I can not clear the contents of the JList. Please help me friends. Here is my code

    private void dateChooserSelectedDatePropertyChange(java.beans.PropertyChangeEvent evt) {                                                       
            DefaultListModel model = new DefaultListModel();
            listSerialNo = new JList(model);
            UpdatePurchase updatePurchase = new UpdatePurchase();
            Vector<String> serialNo = new Vector<String>();
            serialNo = updatePurchase.getSerialNoForSelectedDate(date);

    If I use above code then neither Jlist contains any record nor it clears the contents of JList . If I remove
    DefaultListModel model = new DefaultListModel();
    listSerialNo = new JList(model);
    // if & else code from above code snippet
    then atleast JList contains some records for specific date if available.

    My aim is if there are records available for specific date then that record should be displayed in JList otherwise JList should be empty. Please guide me.
    Thanks .
Showing Visitor Messages 1 to 1 of 1
About nfs3250

Basic Information


Total Posts
Total Posts
Posts Per Day
Visitor Messages
Total Messages
Most Recent Message
August 8th, 2011 03:46 AM
Total Thanks
Total Thanks
  • Thanked 0 Times in 0 Posts
General Information
Last Activity
August 13th, 2011 10:17 AM
Join Date
August 8th, 2011