문제

I have one issue related to JTree swing component, I want to use JTree under Windows high contrast Mode, but it never shows tree nodes according to windows High contrast theme.


Jtree view Under Normal Mode
alt Text


Jtree view Under High Contrast Mode
alt text


Eclipse Package Explorer view Under Normal Mode
alt text


Eclipse Package Explorer view Under High Contrast Mode
alt text

I want to make my applications jtree view same as eclipse's "high contrast" view.

Can anybody guide on this?? I am trying to write a logic like:

// calling this On application load - or via some kind of listener

Toolkit toolkit = Toolkit.getDefaultToolkit(); 
Boolean highContrast = (Boolean)toolkit.getDesktopProperty( "win.highContrast.on" ); 
boolean flag=highContrast.booleanValue();
    if(flag){
    // do stuff for high contrast
    }
    else{
    // show in normal mode
    }

Thanks for your help!!

도움이 되었습니까?

해결책 2

I implemented this with the help of toolkit calls pscode.org/prop/form.html - get Changed font and font size details and apply to jtree

다른 팁

According to this issue is this bug in Swing L&F implementation. There is possible to accept this by modifying Windows L&F and provide it as own, or use different L&F which supports this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top