pivot-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Brown <gkbr...@mac.com>
Subject Re: launching Pivot programmatically
Date Sun, 21 Nov 2010 14:22:13 GMT
Is the test.bxml on your classpath? I'm not sure how the classpath is managed in Rhino, so
I don't have any specific suggestions.

I am curious to know why you want to launch your app via the Rhino shell, though. Any reason
you can't simply launch it via DesktopApplicationContext#main()?

G

On Nov 21, 2010, at 4:36 AM, Jacques Granduel wrote:

> Hi, 
> 
> I'm sorry for coming back on this old thread about learning how to launch a Pivot application
from a shell (Rhino shell in this case). I've made a big step forward trying bxml+ScriptApplication,
but it's still not enough! What am I missing??
> 
> I've saved  this file from the 2.0 tutorial:
> <Window title="Hello JavaScript!" maximized="true"
>     xmlns:bxml="http://pivot.apache.org/bxml"
>     xmlns="org.apache.pivot.wtk">
>     <windowStateListeners>
>         importPackage(org.apache.pivot.wtk);
>  
>         function windowOpened(window) {
>             var label = new Label();
>             label.setText("Hello JavaScript!");
>             label.getStyles().put("font", "Arial BOLD 24");
>             label.getStyles().put("color", "#ff0000");
>             label.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
>             label.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
>  
>             window.setContent(label);
>         }
>     </windowStateListeners>
> </Window>
> into a file test.bxml.
> I use from Java, ScriptApplication.main(new String[]{"--src=path/to/test.bxml"}); or
from Rhino ScriptApplication.main(["--src="path/to/test.bxml"])
> but in both cases, I get an IllegalArgumentException although the text.bxml is found
by Java.
> 
> java.lang.IllegalArgumentException: Cannot find source file "test.bxml".
>         at org.apache.pivot.wtk.ScriptApplication.startup(ScriptApplication.java:47)
>         at org.apache.pivot.wtk.DesktopApplicationContext$2.run(DesktopApplicationContext.java:594)
>         at org.apache.pivot.wtk.ApplicationContext$QueuedCallback.run(ApplicationContext.java:1457)
>         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
>         at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
>         at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
>         at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
>         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
>         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
>         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
>         at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> 
> Thanks again, 
> regards
> jqg
> 


Mime
View raw message