Thursday Dec 11, 2008

Linux & JavaFX Tooling in NetBeans IDE

Follow Weiqi Gao's latest instructions (which I found out about thanks to Jim Weaver today) and you too will be able to develop JavaFX applications in NetBeans IDE, even though you're using Linux (in my case, Ubuntu):

Only Media support doesn't work yet, but that's part of the SDK, unrelated to the NetBeans IDE tooling support, which I now have working perfectly on Ubuntu.

And here's my simple code sample for today, note especially the line in bold:

import javafx.animation.KeyFrame;
import javafx.animation.Timeline;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

var color = Color.YELLOW;

Stage {
    title: "Application title"
    width: 250
    height: 250
    scene: Scene {
        content: [
            Circle {
                centerX: 100,
                centerY: 100
                radius: 40
                fill: bind color
            }
        ]
    }
}
Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
        KeyFrame {
            time: 5s
            canSkip: true
            values: [
                color => Color.GREEN
            ]
        }
    ]
}.play()

The "fill" property of the circle is bound to the "color" variable, which is used in the Timeline, changing gradually to green.

So here's how you'd make the circle move as it changes color (only the changes are in bold):

var color = Color.YELLOW;
var posX = 100;

Stage {
    title: "Application title"
    width: 250
    height: 250
    scene: Scene {
        content: [
            Circle {
                centerX: bind posX,
                centerY: 100
                radius: 40
                fill: bind color
            }
        ]
    }
}
Timeline {
    repeatCount: Timeline.INDEFINITE
    keyFrames: [
        KeyFrame {
            time: 5s
            canSkip: true
            values: [
                color => Color.GREEN
                posX => 200
            ]
        }
    ]
}.play()

Similarly, you can bind the radius to a variable and then change it in the Timeline. This means the circle will become larger which, in turn, creates the impression that it is coming closer and closer to the user of the application.

2009: The Year of Documented Business Scenarios for the NetBeans Platform

The year is drawing to a close and plans for the coming year are being drafted. Personally, my main focus in the coming year in relation to the NetBeans Platform will be—documenting business scenarios for the NetBeans Platform. Up to this point, I've mainly been focused on writing tutorials that cover the main NetBeans APIs and, to a greater or lesser extent, a lot of that is complete, between the NetBeans Platform Tutorials and the NetBeans Developer FAQ, most things have at this stage been covered.

However, what many users are asking for is documentation describing how to optimally connect to a database, how to work with popular frameworks, such as Hibernate and JPA, from a NetBeans Platform application, and similar business scenarios. The issue that describes all these scenarios is this one:

http://www.netbeans.org/issues/show_bug.cgi?id=146402

Creating tutorials that cover those scenarios will be my main focus in the coming year, although this issue would be very helpful to me and to those using the tutorials that come out of it. So, 2009 will be the Year of Documented Business Scenarios for the NetBeans Platform.

If you have any insights to pass on or experiences to share, feel free to do so in that issue or in the comments to this blog entry.

About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« December 2008 »
SunMonTueWedThuFriSat
 
3
7
12
16
17
18
19
21
22
25
26
27
28
29
30
   
       
Today