I've mentioned how simple, elegant and powerful JavaFX Script is. Here's a perfect example of these three qualities. A few weeks ago I wanted to show a progress indicator in a multi-tier application that has a rich client developed in JavaFX Script. Whenever the client is waiting for a response from the server, I wanted to show this progress indicator.
The screenshot above shows the InfiniteProgressPanel widget that I used from the JavaFX Script UI library. It was invented by Romain Guy, a co-author of the book Filthy Rich Clients. It is a great alternative to a progress bar due to the fact that you don't have to continually calculate what percent complete the operation is. This is because the progress bar is circular (and therefore infinite). In addition, it is very easy to use: You just place the InfiniteProgressPanel in the UI containment hierarchy, and bind its progress attribute to a Boolean variable that is true whenever you want the progress indicator to appear. Here's the code for this compiled JavaFX Script example:
/*
* CompiledInfiniteProgress.fx
*
* Developed 2007 by James L. Weaver (jim.weaver at lat-inc.com)
* to serve as a compiled JavaFX Script example.
*/
import javafx.ui.*;
import java.lang.System;
Frame {
var busy = false
title: "Infinite Progress Panel Demo"
width: 400
height: 400
background: Color.WHITE
visible: true
onClose:
function() {
System.exit(0);
}
content:
InfiniteProgressPanel {
progress: bind busy
content:
FlowPanel {
content: [
Button {
text: "Get Busy"
action:
function() {
busy = true;
ConfirmDialog {
title: "Patience is a Virtue"
message: "Simulating a busy condition"
visible:true
onYes:
function() {
busy = false
}
};
}
}
]
}
}
}
Please compile and run this example and try it out for yourself! When you click the Get Busy button, the confirmation dialog will be displayed and the infinite progress indicator will appear. When you dismiss the dialog by clicking the OK button, the progress indicator will disappear.
By the way, the next several posts are going to highlight various UI widgets similar to the way this post does. I'd like to give you an appreciation of the rich set of widgets available in JavaFX Script, and how easy they are to use.
JavaFX Script Boot Camp Announcement
As a heads-up, I will be offering a JavaFX Script 2.5 day "boot camp" on Wednesday, April 9 through Friday, April 11, 2008 (ending at noon) in Indianapolis, Indiana. This course is designed to get you quickly up to speed in JavaFX Script application development. A primary reference for this course is my JavaFX Script book, but the course has its own syllabus which includes material covered in the book as well as up to the minute developments in compiled JavaFX Script. Registration will open soon, and for this pilot class I am accepting 12 students. The cost of this pilot class will be 900 USD per student. Additional students from the same organization will be 600 USD. You'll need to bring your laptop computer with the latest versions of the JavaFX Script downloads (which I'll specify in more detail as the class date approaches). The prerequisite for the class will be the completion of a JavaFX Script programming assignment that I'll post soon to this weblog. I'm looking forward to teaching this class and hope that you can attend!
0 comments:
Post a Comment