java - Change Tooltips with Nimbus -
i'm trying change globaly size of tooltips.
i'm using :
uimanager.put("tooltip.font", new font("sansserif",font.plain,25));
which work fine in general. in case, i'm using nimbus laf code :
uimanager.lookandfeelinfo plafinfo[] = uimanager.getinstalledlookandfeels(); boolean laffound=false; int lafindex=0; (int = 0; < plafinfo.length && !laffound; look++) { if(plafinfo[look].getclassname().tolowercase().contains("nimbus")) { laffound=true; lafindex=look; } } try { if(laffound) { uimanager.setlookandfeel(plafinfo[lafindex].getclassname()); } else {uimanager.setlookandfeel(uimanager.getcrossplatformlookandfeelclassname());} } catch(exception e){logger.getlogger(fenetre.class.getname()).log(level.severe, null, e);} //correct tooltips size uimanager.put("tooltip.font", new font("sansserif",font.plain,25));
in case, uimanager seems ignore instruction, if "tooltip.font" not admitted property in nimbus laf...
but according page : http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/_nimbusdefaults.html property exists.
what's wrong code ? or how can fix other way ?
thanks lot !
nimbus appears work differently other laf's. need set property before set laf:
uimanager.put("tooltip.font", new font("sansserif",font.plain,25)); try { (lookandfeelinfo info : uimanager.getinstalledlookandfeels()) { if ("nimbus".equals(info.getname())) { uimanager.setlookandfeel(info.getclassname()); break; } } } catch (exception e) { // if nimbus not available, can set gui , feel. }
with other lafs believe can change property before create first component of type.
Comments
Post a Comment