Anyone tried the CSS theming yet and having trouble?

156 views
Skip to first unread message

xha...@googlemail.com

unread,
Oct 27, 2015, 6:42:51 AM10/27/15
to CodenameOne Discussions
Hi everyone,

i just tried the css theming mentioned in the blog. I really like the idea. I really dont like the theme editor.
I´ve done the installation as said but it won´t work. In eclipse i get a nullpointer exception if the compilecss ant task is running.

i´ve installed netbeans, installed cn1 and tried the css project but without any success. Even the example project will throw errors after i removed the already compiled .res files which should be created. The errors starts with missing "src.dir" and "run.classpath" properties. After adding these properties, i´ve came to my current error:

class org.w3c.flute.util.Encoding: couldn't load encoding properties 
java.lang.NullPointerException
at org.w3c.flute.util.Encoding.<clinit>(Encoding.java:40)
at org.w3c.flute.parser.Parser.getCharStreamWithLurk(Parser.java:344)
at org.w3c.flute.parser.Parser.parseStyleSheet(Parser.java:99)
at com.codename1.ui.css.CSSTheme.load(CSSTheme.java:4552)
at com.codename1.ui.css.CN1CSSCLI.main(CN1CSSCLI.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
netscape.javascript.JSException: ReferenceError: Can't find variable: $
at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:128)
at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at com.sun.webkit.WebPage.executeScript(WebPage.java:1410)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:934)
at com.codename1.ui.css.ResourcesMutator.lambda$null$25(ResourcesMutator.java:529)
at com.codename1.ui.css.ResourcesMutator$$Lambda$14/160442985.changed(Unknown Source)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:176)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:80)
at javafx.beans.property.ReadOnlyObjectWrapper$ReadOnlyPropertyImpl.fireValueChangedEvent(ReadOnlyObjectWrapper.java:176)
at javafx.beans.property.ReadOnlyObjectWrapper.fireValueChangedEvent(ReadOnlyObjectWrapper.java:142)
at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:112)
at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:145)
at javafx.scene.web.WebEngine$LoadWorker.updateState(WebEngine.java:1214)
at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1325)
at javafx.scene.web.WebEngine$LoadWorker.access$1100(WebEngine.java:1207)
at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1194)
at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2373)
at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2217)
at com.sun.webkit.network.URLLoader.twkDidFail(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidFail(URLLoader.java:842)
at com.sun.webkit.network.URLLoader.access$1300(URLLoader.java:43)
at com.sun.webkit.network.URLLoader$7.run(URLLoader.java:824)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39)
at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112)
at java.lang.Thread.run(Thread.java:745)

Did anyone tried the css theming yet and got it running?

Steve CN1 Hannah

unread,
Oct 27, 2015, 9:38:16 AM10/27/15
to codenameone...@googlegroups.com
The nullpointer stack trace actually isn't a problem.  MIssing src.dir, run.classpath, and "Can't find variable $" would appear to be problems though.  I haven't tested on Eclipse yet.  Only Netbeans.  It is possible that there are differences between the ANT execution environment on eclipse than Netbeans that is causing the problem.  I'll set up eclipse and try it today to see if I can reproduce this problem.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/04146f65-74c4-4679-95a7-5b8d00efb0ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Software Developer
Codename One

xha...@googlemail.com

unread,
Oct 27, 2015, 10:11:35 AM10/27/15
to CodenameOne Discussions
As i said, i´ve installed netbeans too and tried it there but without success.. same issues (missing src.dir and classpath) The Nullpointer exceptions came from the missing src.dir and classpath (line 42 in CN1CSSCompilerTask and line 50 in same class)
After these fixes the error "Can't find variable $" appeared. I managed to get it working now but i dont know yet if the compiled .res file is working.
I just removed the row 1616 in the CSSTheme.java the compiler wont create a screenshot where the error appeared.

Steve CN1 Hannah

unread,
Oct 27, 2015, 10:14:34 AM10/27/15
to codenameone...@googlegroups.com
That line is necessary.  The "can't find $" error means that it isn't loading jQuery (which is used inside the webview for generating images).  Right now it is loading jquery over the network, so if you don't have an internet connection, this may fail.

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

Steve CN1 Hannah

unread,
Oct 27, 2015, 10:22:04 AM10/27/15
to codenameone...@googlegroups.com
What version of the JDK are you using?

xha...@googlemail.com

unread,
Oct 27, 2015, 10:41:32 AM10/27/15
to CodenameOne Discussions
The missing connection was the problem. Havn´t set the proxy for java. Seems to be working now with original ant task jar and the theme is aplied now too.
The missing properties src.dir and classpath still happens( new project from scratch) but to be fair, this is easy.
Thought already that the line i removed was necessary. Thanks for the help

Steve CN1 Hannah

unread,
Oct 27, 2015, 11:34:31 AM10/27/15
to codenameone...@googlegroups.com
Thanks for the feedback.  I have removed the network dependency now -- jquery is now bundled directly.

What specifically did you do to work around the src.dir and classpath issues?

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

xha...@googlemail.com

unread,
Oct 27, 2015, 11:39:15 AM10/27/15
to CodenameOne Discussions
i just added following lines into my build.props file which is included in the build.xml by default:

src.dir=src
run.classpath=JavaSE.jar

Steve CN1 Hannah

unread,
Oct 27, 2015, 12:40:03 PM10/27/15
to codenameone...@googlegroups.com
Thanks.  I have updated the ant task to work with Eclipse now.

I have also updated the wiki with Eclipse-specific install instructions as it appears the build.xml file is a little different on the Eclipse side of the world.

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

xha...@googlemail.com

unread,
Oct 28, 2015, 4:51:17 AM10/28/15
to CodenameOne Discussions
I also ran into the problem, that eclipse wont refresh the compiled .res file cause its modified outside from eclipse. Eclipse dont keep in sync with the filesystem like netbeans. This will cause that the newly compiled .res file wont be used if you run the simulator.
To solve this, you need to go into the "External Tools Configuration" go to the "Refresh" tab and select "Specific resources" and select the folder which contains the .res file.

This will refresh the selected folder after the ant script and the simulator will use the new .res file.

Steve CN1 Hannah

unread,
Oct 28, 2015, 3:16:08 PM10/28/15
to codenameone...@googlegroups.com
Thanks.   I have updated the eclipse instructions accordingly.

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.

kayha...@gmail.com

unread,
Mar 8, 2016, 10:09:44 AM3/8/16
to CodenameOne Discussions
Hi Steve,

i came across this problem:

compile-css:
       
[java] class org.w3c.flute.util.Encoding: couldn't load encoding properties
        [java] java.lang.NullPointerException
        [java]     at org.w3c.flute.util.Encoding.<clinit>(Encoding.java:40)
        [java]     at org.w3c.flute.parser.Parser.getCharStreamWithLurk(Parser.java:344)
        [java]     at org.w3c.flute.parser.Parser.parseStyleSheet(Parser.java:99)
        [java]     at com.codename1.ui.css.CSSTheme.load(CSSTheme.java:4552)
        [java]     at com.codename1.ui.css.CN1CSSCLI.main(CN1CSSCLI.java:79)
        [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        [java]     at java.lang.reflect.Method.invoke(Method.java:498)
        [java]     at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
        [java]     at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
        [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        [java]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        [java]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        [java]     at java.lang.reflect.Method.invoke(Method.java:498)
        [java]     at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
        [java] Mär 08, 2016 4:06:02 PM com.codename1.ui.css.CN1CSSCLI lambda$null$1
        [java] SCHWERWIEGEND: null
        [java] java.lang.RuntimeException: java.io.FileNotFoundException: https://upload.wikimedia.org/wikipedia/en/thumb/c/c1/IPhone_6S_Rose_Gold.jpg.png/225px-IPhone_6S_Rose_Gold.jpg.png
        [java]     at com.codename1.ui.css.CSSTheme.getBackgroundImage(CSSTheme.java:1387)
        [java]     at com.codename1.ui.css.CSSTheme.getBackgroundImages(CSSTheme.java:1131)
        [java]     at com.codename1.ui.css.CSSTheme.updateResources(CSSTheme.java:845)
        [java]     at com.codename1.ui.css.CN1CSSCLI.lambda$null$1(CN1CSSCLI.java:96)
        [java]     at java.lang.Thread.run(Thread.java:745)
        [java] Caused by: java.io.FileNotFoundException: https://upload.wikimedia.org/wikipedia/en/thumb/c/c1/IPhone_6S_Rose_Gold.jpg.png/225px-IPhone_6S_Rose_Gold.jpg.png
        [java]     at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1836)
        [java]     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
        [java]     at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
        [java]     at java.net.URL.openStream(URL.java:1045)
        [java]     at com.codename1.ui.css.CSSTheme.getBackgroundImage(CSSTheme.java:1358)
        [java]     ... 4 more

Do you have a clue? i think its because some resources online are missing(IPhone6S....)
I changed the runtime to JDK8 from JDK7 and also set the firewall rules to connect trough.

Regards
kaya

Steve CN1 Hannah

unread,
Mar 8, 2016, 11:04:31 AM3/8/16
to codenameone...@googlegroups.com
The first nullpointer is just "normal".   The FileNotFoundException is because that image doesn't appear to exist.  Check the URL.

Steve

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

kayha...@gmail.com

unread,
Mar 8, 2016, 11:46:27 AM3/8/16
to CodenameOne Discussions
i am not using these Links, so is that maybe of the IPhone skin from the simulator?

and while building, a window appears, can i deactivate it opening or what is it god for? =)

Steve Hannah

unread,
Mar 8, 2016, 11:52:19 AM3/8/16
to codenameone...@googlegroups.com
It looks like you are building the css demo project, as this image is in that stylesheet.  I guess that image was removed from wikimedia:

Do you have this file inside your project's "css" directory? 

On Tue, Mar 8, 2016 at 8:46 AM, <kayha...@gmail.com> wrote:
i am not using these Links, so is that maybe of the IPhone skin from the simulator?

and while building, a window appears, can i deactivate it opening or what is it god for? =)

--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at https://groups.google.com/group/codenameone-discussions.

For more options, visit https://groups.google.com/d/optout.



--
Steve Hannah
Web Lite Solutions Corp.

kayha...@gmail.com

unread,
Mar 8, 2016, 11:57:40 AM3/8/16
to CodenameOne Discussions
Oh yeah, my mistake!
you are totally right, i will try it tomorrow without those links, so then my theme.css.res should be generated in "/src" then? =)

Steve CN1 Hannah

unread,
Mar 8, 2016, 11:59:08 AM3/8/16
to codenameone...@googlegroups.com
On Tue, Mar 8, 2016 at 8:57 AM, <kayha...@gmail.com> wrote:
Oh yeah, my mistake!
you are totally right, i will try it tomorrow without those links, so then my theme.css.res should be generated in "/src" then? =)

Yes.  That's correct.

Steve

Kaya TC

unread,
Mar 9, 2016, 3:57:14 AM3/9/16
to CodenameOne Discussions

Works now, thank you Steve.


if its ok, i will attach some configuration pictures for other developers, as the howto was a bit unclear at this point regarding eclipse.




Reply all
Reply to author
Forward
0 new messages