pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Volkert <tvolk...@gmail.com>
Subject Re: Tutorial Runtime Error
Date Mon, 03 Aug 2009 22:50:01 GMT
Hi Scott,
<ImageView image="..." /> translates to ImageView.setImage(String) (
http://incubator.apache.org/pivot/1.3/docs/api/org/apache/pivot/wtk/ImageView.html#setImage(java.lang.String)),
where the string is a resource name as per ClassLoader.getResource(String) (
http://java.sun.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)
).

Thus, the path to your image must be found on your classpath.

Alternatively, you can prepend the string with "@" and use a relative path,
in which case the value will be converted to a URL relative to your WTKX
file, and Imageview.setImage(URL) will be called.

Hope that helps,
-T

On Mon, Aug 3, 2009 at 6:40 PM, Scott Lanham <lists@sael.com.au> wrote:

> Hello,
>
> I am up to the part of the tutorial: http://cwiki.apache.org/PIVOT/labels-
> image-views.html and am doing something wrong but can't figure it out.
>
> Instead of just using the tutorial code as is I like to change things
> slightly
> so that I get a better feel for the toolkit. So I changed the location of
> the
> clock.png file but I get a "Null Image Alert" from the following code:
>
> <Window title="Labels" maximized="true"
>    xmlns:wtkx="http://incubator.apache.org/pivot/wtkx/1.1"
> xmlns="pivot.wtk">
>    <content>
>        <FlowPane styles="{padding:4, verticalAlignment:'center'}">
>            <ImageView image="/home/scott/devel/src/clock.png"
> cursor="crosshair"/>
>            <Label text="What time is it?"/>
>        </FlowPane>
>    </content>
> </Window>
>
> The file does exist in that location as I can take the path and paste it
> into a
> graphics editor. Any help appreciated.
>
> Cheers,
>
> Scott.
>

Mime
View raw message