Monday, May 14, 2012

Icon of JTree for top level element looks cut when using SynthLookAndFeel

I have a strange behavior when "plus" image of top level element of JTree is cut in the middle. (This image for all other levels look good)



For example: if I use the following method images look correct:



UIManager.put("Tree.collapsedIcon", IconFactory.getImage("Images/nodeClosed.png"));


and it look like this:
enter image description here



If i use "SynthLookAndFeel" it look cut in the middle:



SynthLookAndFeel laf = new SynthLookAndFeel();
InputStream is = EmsApplet.class.getResourceAsStream("lNf_test.xml");
laf.load(is , EmsApplet.class);
UIManager.setLookAndFeel(laf);


it look like this:enter image description here



And here is part of XML file:



<style id="TreeStyle">
<imageIcon id="treeCollapsedIcon" path="nodeClosed.png"/>
</style>


note: red color is just to mark specific region. please ignore it.





No comments:

Post a Comment