Results 1 to 2 of 2
  1. #1
    Fingar is offline Member
    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    Default JList with JScrollPane in a JPanel

    I have a JList in a scrollpane in a Jpanel and the panel is in a frame, the list wont scroll.
    Heres my code:
    Java Code:
    private class ListPanel extends JPanel{
        public ListPanel(){
            setLayout(new FlowLayout());
             setBorder(BorderFactory.createTitledBorder("List"));
                
            String [] sa = {"This", "is", "a", "JList"}; //String array
                
            JList list = new JList(sa);
            JScrollPane sc = new JScrollPane(list);
            add(sc);
                
        }
    }
    Is it impossible to get the list to scroll when it is in a panel?
    Last edited by Fingar; 06-16-2012 at 10:19 PM.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 4
    Last Post: 12-29-2011, 09:23 AM
  2. JList inside JScrollPane is not displaying
    By _SAS in forum AWT / Swing
    Replies: 2
    Last Post: 07-31-2011, 09:45 PM
  3. JPanel and JScrollPane inheritance
    By ohiggins in forum AWT / Swing
    Replies: 1
    Last Post: 02-15-2011, 03:53 PM
  4. JPanel/JScrollPane issue
    By Moncleared in forum New To Java
    Replies: 1
    Last Post: 09-23-2010, 05:02 AM
  5. Replies: 1
    Last Post: 05-09-2010, 07:34 PM

Tags for this Thread

Posting Permissions

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