You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pivot.apache.org by Yunlong Zhao <Yu...@ingres.com> on 2010/11/02 23:00:38 UTC
TreeBranch.setExpandedIcon("@images/iconfile.png") Doesn't work in Pivot 2.0
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
Re: TreeBranch.setExpandedIcon("@images/iconfile.png") Doesn't work in
Pivot 2.0
Posted by Greg Brown <gk...@mac.com>.
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
>
>
>