You need to add your JList (or any component) to a JScrollPane. Easiest way to do this is to pass your component to the JScrollPane’s constructor. You then add the JScrollPane to your component hierarchy (instead of adding your JList).
JScrollPane scrollPne = new JScrollPane(mylist); panel.add(scrollPane);
Leave a Reply
You must be logged in to post a comment.