Scrollable « JList « Java Swing Q&A





1. JList (Scrollable?)    coderanch.com

2. A scrollable JList?    coderanch.com

import java.awt.*; import javax.swing.*; import java.util.Vector; public class ListTest { public ListTest() { JFrame frame = new JFrame(); frame.setSize(400,300); frame.setLocation(200,200); Container c = frame.getContentPane(); JList list = new JList(); Dimension dim = new Dimension(150,100); list.setPreferredSize(dim); JScrollPane sp = new JScrollPane(list); sp.setPreferredSize(dim); JPanel north = new JPanel(); JPanel south = new JPanel(); dim.setSize(400,140); north.setPreferredSize(dim); south.setPreferredSize(dim); north.add(sp); c.add(north,"North"); c.add(south,"South"); //Create some data Vector ...

3. Scrollable JList    coderanch.com

I want to write a method requestScroll for a scrollable JList with the method signature public void RequestScroll(integer line, integer scrollPolicy) The RequestScroll method scrolls an item to a specified position in the scroll list display area, moving other items into and out of the display area as necessary. The line parameter specifies the item to scroll. The scrollPolicy parameter specifies ...