As Todd mentioned earlier, you may be better off working through the tutorials from SVN. Quite a few things have changed between 1.2 and 1.3, particularly in the area of WTKX.

I'd recommend that you get the latest source and run the deploy target, since that will build the latest version of the tutorial apps and documentation. However, if you just want to read the WTKX Primer, you can get it here:

http://svn.apache.org/repos/asf/incubator/pivot/trunk/tutorials/www/wtkx_primer.template.html

Greg


On Aug 3, 2009, at 6:51 PM, Todd Volkert wrote:

Actually, in case you haven't read it yet, the WTKX primer on the Wiki is a really good resource. It can be found at http://cwiki.apache.org/PIVOT/wtkx-primer.html

Cheers,
-T

On Mon, Aug 3, 2009 at 6:50 PM, Todd Volkert <[email protected]> wrote:
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 <[email protected]> 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.



Reply via email to