Results 1 to 2 of 2

Thread: Refresh jList

  1. #1
    karq is offline Member
    Join Date
    May 2010
    Rep Power

    Default Refresh jList


    so I'm stuck again, how to I refresh a jList? I have a textfield and an Add button. When I add text from the textfield to the database I would like to refresh the jList after the text is added to the database. How to I do it?

    Heres my jlist code:
    (Using netbeans swing design gui)
    Java Code:
    DefaultListModel model = new DefaultListModel();
    jList1 = new javax.swing.JList(model);
    jList1.setModel(new DefaultListModel() {
        DerbyCon der = new DerbyCon();
        ArrayList todo = der.getTodo();
        public int getSize() { return todo.size(); }
        public Object getElementAt(int i) { return todo.get(i); }
    jList1.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {

  2. #2
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Rep Power


    Did you read the JList API? You will find a link to the Swing tutorial on "How to Use Lists" which has an example that does this.

Similar Threads

  1. How to refresh my JInternalFrame upon CUD
    By chyrl in forum AWT / Swing
    Replies: 2
    Last Post: 04-01-2010, 04:22 PM
  2. JList refresh
    By pbaudru in forum AWT / Swing
    Replies: 5
    Last Post: 01-20-2010, 10:24 AM
  3. Refresh Button?
    By jls7168 in forum New To Java
    Replies: 2
    Last Post: 02-06-2009, 06:44 PM
  4. Avoiding refresh
    By java_srinivasan in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 06-25-2008, 09:01 AM
  5. refresh a different window
    By marceldupont in forum AWT / Swing
    Replies: 3
    Last Post: 03-22-2008, 02:44 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