by Jonathan Giles | Nov 29, 2009 | Links
Hello, and welcome to a new weekly post on FX Experience. In this post, and all future ‘JavaFX links of the week’, we’ll be covering the latest and greatest JavaFX news that you may have missed in the past week. You may recognise this segment, as it is a subset of the ‘Java desktop links of the week’ that I post on my own blog. Whilst I work out the best way to go forward, the JavaFX links section will find itself being duplicated on both sites.
As with my website, this weekly post tries to not take itself too seriously. We certainly won’t be covering every JavaFX news item every week – we’ll pick out the quality topics that we think you’d like. Also, whilst we all work on JavaFX at Sun, we usually don’t have any insight into the projects we’re linking to, so sometimes we might make mistakes in summarising links. So, if you want to flame anyone, pick me – the best way is to email me. Also, I’d appreciate any links you may have that you think deserve some coverage.
- This week on FXExperience.com Richard Bair blogged about ‘language lessons 1: object creation‘, and ‘writing a Java-based game‘, and Jasper Potts posted a number of sample text effects that he created in JavaFX.
- Coming up in a future release of NetBeans is a JavaFX GUI builder (it’ll be available as a preview release in 6.8). This differs from the authoring tool also being developed by Sun, as the JavaFX GUI builder is intended more for developers, rather than the designers who would find more use in the authoring tool. Unfortunately, right now it doesn’t have a name – can you help? For some inspiration, screenshots can be seen here and here.
- Stephen Chin has announced a JFXtras 0.6 preview release has been made available, with a full release coming up as soon as any kinks are worked out. JFXtras 0.6 sees a number of new features, controls, and of course bug fixes. It is a great filler library should the functionality not exist in the core JavaFX release.
- Chris Wright and Jim Weaver put up a new article in their “What’s new in JavaFX 1.2 technology” series, this time covering RSS, storage and charts.
- Stephen Chin put up his Devoxx conference session slides for you to enjoy.
- Rakesh Menon expanded on his Combo Box control that he developed a few months ago by making it work on mobile devices as well.
- Johan Vos has posted part two in his series of ‘JavaFX and OSGi‘, where he introduces the OSGiFX framework.
- Lawrence Premkumar has written a sample application showing spinning text.
- Peter Pilgrim has posted milestone 4 of his Nelson Core JavaFX Framework and Xenon Data Grid control for JavaFX. As far as I can tell, that mouthful equates to a table control for JavaFX. Please, someone correct me if I’m wrong. You can play with the control yourself by loading the webstart link, and clicking on the images to start the demo.
That’s the first week of JavaFX links of the week down. If you’re interested in other Java desktop technologies, check out Java desktop links of the week, and remember to follow the fxexperience twitter stream for more updates.
by Jasper Potts | Nov 25, 2009 | UI Design
I came across the cool blog by Rakesh Menon the other day “JavaFX – Text Effects”. It got me thinking how many other cool text effects could we do in JavaFX. Quick research for ideas came up with “50 Stunning Photoshop Text Effect Tutorials” blog post on Smashing Magazine. So I picked a couple fun ones and had a go 🙂
Neon Text
Click To Run
(more…)
by Richard Bair | Nov 24, 2009 | General, Web Services
In a post from earlier this year I explored the concept of background tasks in JavaFX. If you haven’t yet, you might want to review that article before reading on. For the impatient: JavaFX is currently a single threaded programming language. All code you write in JavaFX occurs on the same thread. Since you don’t want to write an unresponsive application, you need to write long-lived operations on a background thread. The Task API provides a single consistent abstraction which all background operations in JavaFX are based on. This means whether you are computing fibonacci sequences, breaking down protein chains, writing to a database or reading data from disk there is a single consistent programming model and API that your GUI communicates with. And we think this is a pretty good idea. (more…)
by Richard Bair | Nov 23, 2009 | Language Lesson
We’re intending to write a number of different smaller blog entries focused on describing various features and usages of JavaFX Script. I was asked several times by people this week at Devoxx, why choose JavaFX instead of HTML, Flex, or something else? The two real strong advantages of JavaFX are that 1) you have access to a wealth of Java APIs if you need it, and 2) Developing in JavaFX Script is highly productive.
It is this second point that I hope becomes clear and I hope to convey with this series of Language Lessons. Many times Jasper and I have been holed up writing demos with JavaFX and it is not uncommon for us to just pipe up every so often with “this is just so cool” or “javafx makes some things reaaaaally nice”. I know this sounds like the cheerleader squad coming from the guys who have been part of building this product. Call it pride in craftsmanship. Its honestly how we feel, and hope to convey this to you as we go along.
So with that, here’s the first Language Lesson: Object Creation.
There are actually two different syntaxes for creating objects in JavaFX. One should be used for creating Java objects, and the other for creating JavaFX objects. If you are going to create a Java Object, you will most often want to use the “new” keyword — exactly like you do in Java. You can either use the default no-arg constructor (if the class you are creating has one) or one of the other constructors. For those not familiar with Java, it looks like this:
[jfx]
def obj = new StringBuffer("Hello World");
[/jfx]
The second syntax is what we call the Object Literal syntax, and looks more like object creation in JavaScript than in Java. JavaFX Script supports a different concept for object creation and initialization from Java. In the Java world, you have to call one of a fixed set of (generally) explicitly defined “constructors”, which are essentially special functions that create an object. Each constructor has certain parameters, just like functions.
This usually led to object creation & initialization code that looked like this:
JButton button = new JButton();
button.setText("Cancel");
In JavaFX Script, there are no explicit constructors. Instead, you say what object you want to create and what initial values to give to each variable. If you don’t define an initial value for a variable, then the class will use its own initial value. For example, you might do this in JavaFX Script:
[jfx]
Button {
text: "Cancel"
}
[/jfx]
There are some subtle differences between these two cases for a library author (like me), but it works really exactly the same as far as users of the library (like you) are concerned. The difference is that the traditional Java approach is very procedural (do this, then do that) whereas the FX way is declarative. In such simple examples as this it makes no difference, but as we will soon see as the Language Lessons continue, this declarative style lends itself to some very cool possibilities.
Until next time, have fun coding.
by Jasper Potts | Nov 20, 2009 | Devoxx, Games
We recently finished our session at devoxx on “JavaFX Games”, for all you you who have attended or read our previous post and played the game, here is the source.
Download Source
Enjoy!
We are excited to see all your cool physics experiments and games so please post links in comments.