ScrollBar Problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sumancal
    New Member
    • Mar 2008
    • 4

    ScrollBar Problem

    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.
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by sumancal
    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.
    Please use codetags with posting codes so that our experts here can read it easily.

    sukatoa.

    Comment

    Working...