Reading Sun's LWUIT mailing list and forum for quite a long time now I decided to compile my personal "favorite" list of questions that are being asked over and over again. The goal is that people find it before they feel the need to ask it in the forum again. Shai, Chen (the two main developers of LWUIT at Sun) and other forum members will probably answer in a very minimalistic way to such questions so I'll try to add a little more background info here.
Make sure to also read the official FAQ section of the LWUIT project.
Q: Special characters like ñ, á, ä, é, í, ó, ö, ú, ü are not displayed?
A: Add these chars (umlaute, etc.) to your charset or avoid bitmap fonts. The charset can be modified in the LWUIT Designer or if you use the ant taks in the "charset" attribute of the "font" tag.
Q: How build LWUIT for RIM BlackBerry?
A: Shai wrote an Article about this lately: Building A Project On The BlackBerry. For my personal taste it's focused too much on NetBeans, neglecting people that use Eclipse instead. But using bb-ant-tools only requires Ant which makes it independent of the IDE, so just take the build.xml file as a starting point. Here's an interesting BlackBerry forum thread: How to use bb-ant-tools with Eclipse. And here's another article by Thorsten - the guy who wrote ports for BB and Android, thanks for that! - on this topic. You can even get the example ant build scripts from there!
Maybe I'll also dedicate a whole post for this topic in the future.
Q: Can I format text within a TextArea, similar to RichText or HTML?
A: LWUIT doesn't support this feature, but there is a class called RichTextArea in the lwuitfixes project. Here's its description: "Displays rich text, where 'rich' refers to variations in font size and style." I have not used it myself - but probably will need it one day.
Q: Should I reuse Forms and Components or instantiate them new every time?
A: Basically Forms and Components are leightweight objects (as the name 'LeightWeight UI Toolkit' suggests) so there is not too much to worry about when recreating them. It depends a lot on your use case, trading off memory vs. CPU performance. Generally it's better approach to keep the memory footprint as low as possibly and tweak performance only when you run into problems or have an unresponsive UI.
Q: I get a java.lang.IllegalStateException when I try to draw on a Image's Graphics object?
A: Probably what you have is an immutable Image from a file which you cannot paint on. Create an "empty" mutable Image with Image.createImage(width, height) and paint the Image from the file on it's Graphics. Check the javadocs of the Image class.
Q: Can I use LWUIT in commercial projects and applications?
Yes, LWUIT is licensed under GPL + Classpath Exception so it is 100% free for commercial use! See Shai's post.
I will add more QAs over time here. Feel free to add comments and help me improve this article.
Sunday, December 6, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment