The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Do It Clean

Posted by editor on March 11, 2009 at 8:59 AM PDT

Using CSS for JavaFX

One of the more clever ideas in JavaFX is the use of CSS to style GUI components. In other toolkits, information about size, shape, color, and font might be hard-coded in source, or freeze-dried in binary form: either way, these graphic elements have traditionally been the responsibility of developers. Of course, the irony is that most developers aren't and don't care to be designers, so at best, they're adapting a designer's intentions to code. At worst, the developer him- or herself is left to pick colors and fonts. And we know how well that usually works out, right?

By putting styling in CSS, JavaFX makes a smart choice: it leaves the styling in a format where it can be created and maintained by graphic designers, using the language and tools they're already used to from web design.

So how does it work? In a particularly helpful example posted to the JFX Studio site, Rakesh Menon has posted the game JavaFX Sudoku with CSS.

"This is a Sudoku game developed using JavaFX. The objective is not really to demonstrate Sudoku, but to show Cascading Style Sheets (CSS) support in JavaFX. This sample uses two CSS files - blue.css and black.css. These files have information about different user interface attributes such as color, font, shape…"

Rakesh's choices seem pretty acceptable for the casual Sudoku player, but if you wanted to "skin" the app to suit some other environment, all you have to do is edit the CSS files.


Also in Java Today, the JCP has announced that Aplix has won the special election to fill a vacated seat on the JCP's ME Executive Committee. "91 or 8.93% of the elegible JCP members voted for the four candidates", with Aplix getting 43.96% of the vote. Aplix will serve out the term vacated by Intel, ending in December 2010.

The latest edition, issue 192, of the JavaTools Community Newsletter is out, with tool-related news from around the web, greetings to new projects in the community, a graduation (egest), and a Tool Tip on using the Maven help plugin to inspect your settings.


In today's Weblogs, Kohsuke Kawaguchi announces Changes to the java.net Maven2 repository. "This is an important notice for those of you that uses the java.net Maven2 repository, as we are moving a repository from one location to another."

In the success story Involver.com - JRuby-on-Rails and GlassFish powering an online video marketing platform, Arun Gupta writes, "Involver.com is an online video marketing platform that allows brands to build, promote, manage, and track video campaigns on social networks for targeted audiences. The platform is powered by Ruby-on-Rails, JRuby 1.1.6, and GlassFish v2 UR2."

Finally, Felipe Gaucho reminds us of the Jazoon Rookie deadline: 15 March 2009. "If you are under 26 years old and have a good speech, you have few more days to try earn a free voucher + free air ticket to assist Jazoon'09."


In today's Forums, kleopatra warns of [FYI] SwingX Stormy Weather ... "... as we are in the middle of some code-breaking changes for 0.9.6, discussed agreed on in http://forums.java.net/jive/thread.jspa?threadID=55628&tstart=0. The code-base was tagged before the breaking changes with pre-096-code-breaking-changes-10mar2009, to allow for checking out a most-bug-fixed version before these changes. The last weekly has the same stability (if it happened, can't be sure with all our server probs - Jan?). A gentle reminder to our committers: we have a wiki page documenting change history (at least as far as code-breaking changes go) - please be sure to keep that in synch with the changes as you go along. For your convenience, the link to that page: http://wiki.java.net/bin/view/Javadesktop/SwingXChanges."

tisoft_media reports Running LWUIT-Demo on MicroEmulator on (jailbroken) iPhone. "I'm currently porting MicroEmulator (http://microemu.org) to jailbroken iPhones. I did a quick test with running LWUIT on it, and while it was very slow and had some graphic errors, it actually worked. See some screenshots here: http://markus.heberling.net/2009/03/10/lwuit-on-microemulator-on-iphone. I expect to get the performance better, but will try to correct the graphical glitches first. Make it run, make it right, make it fast."

mick_000 wonders about setting up JXTA pipes, in Re: OutputPipe connection failed. "How long will the PipeMsgListener object wait for receiving messages??? From an edge peer i created an pipe adv and used the listener object and when a rendezvous peer using that pipe adv, created an o/p pipe and sent the msg then no msg was received. After creating an i/p pipe,the pgm stops executing and doesn't wait for msg receive event to occur. Do I have to explicitly mention a waiting time to receive msg events?????"


Current and upcoming Java Events :

Registered users can submit event listings for the java.net Events Page using our events submission form. All submissions go through an editorial review before being posted to the site.


Archives and Subscriptions: This blog is delivered weekdays as the Java Today RSS feed. Also, once this page is no longer featured as the front page of java.net it will be archived along with other past issues in the java.net Archive.



Using CSS for JavaFX
Comments
Comments are listed in date ascending order (oldest first)