I don't know if this is just when I'm using the the DefaultListModel
instead of a vector
, but the issue is that when I make my JList
& JScrollPane,
the scrollbars show correctly but i cannot scroll even though there are enough elements to fill the full window.
Source code:
panel_unit.add(YUi.JScrollPane(list = YUi.JList(main.config.fdata,0,0,this,0),500,314,JScrollPane.HORIZONTAL_SCROLLBAR_NEVER,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS),5,5);
public static JList JList(DefaultListModel text,int width,int height,ListSelectionListener listener,int SelIndex) {
JList list = new JList(text);
list.setPreferredSize(new Dimension(width,height));
list.setSelectedIndex(SelIndex);
list.addListSelectionListener(listener);
return list;
}
public static JScrollPane JScrollPane(Component text,int width,int height,int HorizontalScrollBarPolicy,int VerticalScrollBarPolicy) {
JScrollPane scrollpane = new JScrollPane(text);
scrollpane.setPreferredSize(new Dimension(width,height));
scrollpane.setHorizontalScrollBarPolicy(HorizontalScrollBarPolicy);
scrollpane.setVerticalScrollBarPolicy(VerticalScrollBarPolicy);
return scrollpane;
}