I have Jlist , and i am using HORIZONTAL WRAP , and now want a VerticalscrollB ar when needed.
i am giving you the my sample of code
public void reinitialize() {
removeAll();
setLayout(new GridLayout(0, 1));
list = new JList(new AddaxFMSBodyLis tModel(super.ge tBodyPanel().ge tEntityList())) ;
list.setCellRen derer(new AddaxFMSBodyLis tViewCellRender er());
list.setVisible RowCount(-1);
//list.setSize(ne w Dimension(30, 30));
list.addListSel ectionListener( new AddaxFMSBodyLis tSelectionListe ner());
DragSelectionLi stener dragListener = new DragSelectionLi stener();
list.addMouseMo tionListener(dr agListener);
list.addMouseLi stener(dragList ener);
PopUpListener popUp = new PopUpListener() ;
list.addMouseLi stener(popUp);
list.setLayoutO rientation(JLis t.HORIZONTAL_WR AP);
JScrollPane scrollPane = new JScrollPane(lis t,
JScrollPane.VER TICAL_SCROLLBAR _AS_NEEDED,
JScrollPane.HOR IZONTAL_SCROLLB AR_NEVER);
add(scrollPane) ;
}
but here is the problem is that vertical scrollbar always come.
and i need when its needed .
Can any body help.
i am giving you the my sample of code
public void reinitialize() {
removeAll();
setLayout(new GridLayout(0, 1));
list = new JList(new AddaxFMSBodyLis tModel(super.ge tBodyPanel().ge tEntityList())) ;
list.setCellRen derer(new AddaxFMSBodyLis tViewCellRender er());
list.setVisible RowCount(-1);
//list.setSize(ne w Dimension(30, 30));
list.addListSel ectionListener( new AddaxFMSBodyLis tSelectionListe ner());
DragSelectionLi stener dragListener = new DragSelectionLi stener();
list.addMouseMo tionListener(dr agListener);
list.addMouseLi stener(dragList ener);
PopUpListener popUp = new PopUpListener() ;
list.addMouseLi stener(popUp);
list.setLayoutO rientation(JLis t.HORIZONTAL_WR AP);
JScrollPane scrollPane = new JScrollPane(lis t,
JScrollPane.VER TICAL_SCROLLBAR _AS_NEEDED,
JScrollPane.HOR IZONTAL_SCROLLB AR_NEVER);
add(scrollPane) ;
}
but here is the problem is that vertical scrollbar always come.
and i need when its needed .
Can any body help.
Comment