java - JScrollBar don't show thumb in Nimbus L&F -
i got problem happens on nimbus l&f. if there many items in jlist, thumb of jscrollbar disappear. in metal l&f, thumb visible, because has min size. have checked logic in nimbus l&f, there have same min size. not effected.
please see code below:
public static void main(string[] args) { (uimanager.lookandfeelinfo info : uimanager.getinstalledlookandfeels()) { if ("nimbus".equals(info.getname())) { try { uimanager.setlookandfeel(info.getclassname()); } catch (classnotfoundexception ex) { logger.getlogger(demo.class.getname()).log(level.severe, null, ex); } catch (instantiationexception ex) { logger.getlogger(demo.class.getname()).log(level.severe, null, ex); } catch (illegalaccessexception ex) { logger.getlogger(demo.class.getname()).log(level.severe, null, ex); } catch (unsupportedlookandfeelexception ex) { logger.getlogger(demo.class.getname()).log(level.severe, null, ex); } break; } } jframe f = new jframe("metal (height 300)"); string[] ss = new string[100]; (int = 0; < ss.length; i++) { ss[i] = "" + i; } jlist<string> l = new jlist<string>(); l.setlistdata(ss); final jscrollpane jscrollpane = new jscrollpane(l); f.getcontentpane().add(jscrollpane); f.setdefaultcloseoperation(jframe.exit_on_close); f.setsize(300, 300); f.setvisible(true); }
when set "f.setsize(300, 300);", thumb disappear.
but if set "f.setsize(300, 400);", thumb visible.
how can set thumb visible?
try set minimum size of thumb 1
getdefaults().put("scrollbar.minimumthumbsize", new dimension(29, 1));
Comments
Post a Comment