The '@' syntax only works in BXML. It means "load the image from a path that is relative to the current file". I think what you are trying to do is load the image from an absolute path (i.e. one that is relative to the classpath). You should use a string that starts with a "/" - the fact that the '@' symbol works is just a side-effect, since setIcon(String) simply drops the first character.
However, I have fixed the issue with setExpandedIcon(). Thanks for catching that. G On Nov 2, 2010, at 6:00 PM, Yunlong Zhao wrote: > Hi All, > > I am migrating pivot 1.5.2 application to pivot 2.0 and converting the > following statement in 1.5.2 (these two statements work just fine in pivot > 1.5.2): > > myTreeBranch.setIcon(“images/iconfile.png”); > myTreeBranch.setExpandedIcon(“images/expandedIconfile.png”); > > To > > myTreeBranch.setIcon(�...@images/iconfile.png”); > myTreeBranch.setExpandedIcon(�...@images/expandedIconfile.png”); > > For pivot 2.0. > > The setIcon method works fine but I got the following exception for the > setExpandedIcon method: > > java.lang.IllegalArgumentException: expandedIconURL is null. > > > at > org.apache.pivot.wtk.content.TreeBranch.setExpandedIcon(TreeBranch.java:84) > at > org.apache.pivot.wtk.content.TreeBranch.setExpandedIcon(TreeBranch.java:117) > at > com.ingres.director.RunningServers.populateTreeModel(RunningServers.java:443) > at > com.ingres.director.RunningServers.getTreeModel(RunningServers.java:186) > at com.ingres.director.StartStopSheet.populateServerBoxPane(Unknown > Source) > at com.ingres.director.StartStopSheet.<init>(Unknown Source) > at com.ingres.director.StartStopSheet1.buttonPressed(Unknown Source) > …… > > > Is this a bug in 2.0? > > Thanks, > > Yunlong > > >
