JScrollPane not scrolling Dynamic JList

From: dcipher (jweeks_at_neuraldk.org)
Date: 10/31/03

  • Next message: Roedy Green: "Re: JScrollPane not scrolling Dynamic JList"
    Date: Thu, 30 Oct 2003 19:39:09 -0500
    
    

    Hello all,

    I've got two dynamic JLists (they change at run time based on user input)
    constructed from a DefaultTableModel, like so:

    =====
    filesToWatch = new DefaultListModel();
    actionsList = new DefaultListModel();
            
    filesToWatch.addElement("/Just_a_test/filename.jpg");
    filesToWatch.addElement("/another/test/andStuff");
    filesToWatch.addElement("/home/dcipher/deleteMe.test");
            
    listFiles.setModel(filesToWatch);
    listActions.setModel(actionsList);
    =====

    Where listFiles, and listActions are JLists

    And I encompass them in JScrollPane's:

    =====
    scrollFileList = new javax.swing.JScrollPane();
    scrollFileActions = new javax.swing.JScrollPane();
    scrollFileList.setViewportView(listFiles);
    scrollFileActions.setViewportView(listActions);
    =====

    However, no matter how many items I add to the JList, it seems the
    JScrollPanes still think this list is only 1 item long, or similar, because
    the scrollbars only appear when the window is sized incredibly small (well
    beyond where they _should have_ appeared).

    Any ideas or suggestions as to why?

    filesToWatch.getSize() returns the proper size of 3 at startup, and
    increments according to how many items are there. As does
    listFiles.getSize()... what does JScrollPane used to discern how large it's
    child is?

    Thanks,
    Jeff

    jweeks // _at_ // mailandnews // _dot_ // _calm_


  • Next message: Roedy Green: "Re: JScrollPane not scrolling Dynamic JList"