Archive

Archive for the ‘JavaFX’ Category

Quick note about JavaFX Sequences

July 27th, 2009 joconner No comments

If you’re learning about JavaFX, you probably already know about some of the basic data types: String, Number, and others. But what do you know about sequences?

A JavaFX sequence looks and behaves much like a Java array. A sequence is an ordered list of objects. Unlike JavaScript, JavaFX Script requires that each item in the list share the same type. The following code shows a sequence of Strings:

var names = ["John", "Gary", "Ruby", "Nick"];

JavaFX infers the correct type, but you can be explicit:

var names: String[] = ["John", "Gary", "Ruby", "Nick"];

Above, the names variable has the “Sequence of Strings” type.

Like arrays, sequences can be accessed by content index. A sequence’s position (index) is a number from 0 through n-1, where n is the number of items in the sequence. You can use the sizeof operator to tell you how many items are in a sequence.

var size = sizeof names;
println("size of names: {size}");

The easiest way to iterate through a sequence is with the for-in loop like this:

var friends: String[] = ["Jack", "Nick", "Matthew"];
for (friend in friends) {
    println("My friend: {friend}");
}

Note that the friend variable inside the for loop does not have a var declaration.

VN:F [1.9.22_1171]
Rating: 2.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: JavaFX Tags:

Speculations on Google Chrome OS

July 9th, 2009 joconner No comments

Today’s announcement of Google’s Chrome OS is exciting in a few ways. I think it has implications for Java developers. With hindsight, I now think that Larry Ellison was hinting about Google’s Chrome OS when he expressed some of his desires for JavaFX on small netbook-like devices.

So, without any real knowledge and armed with nothing more than a vivid imagination, I provide some of my predictions/speculations for the upcoming Google Chrome OS and the devices it will power:

  1. Google Chrome OS will be a slightly more beefy Android OS. More beefy because it will have additional hardware driver support you might find in a netbook. However, its essence will be Android OS.
  2. The Chrome browser (or a slimmed down cousin) will be the primary application on that OS. It’s already integrated into Android via Webkit
  3. The developer API will be very similar to what Android G1 developers already use. Android G1 apps are essentially Java apps written to a Java-like API. Same Java language on top of the most important, core packages of the Java SE platform. And, of course, Google won’t be able to call it a “Java” platform because it will be stripped down to what Google engineers consider only the core, “good” parts of Java SE APIs + Google’s own Android APIs of course.
  4. Google Chrome OS will be attractive to Java engineers because it looks and feels so much like the the JVM…except it’s really the Dalvik VM. Many simple applications that run on Java SE will be able to run on the Dalvik VM after a recompile. Or maybe you’ll just have to run your class files through a simple converter to target the Dalvik VM. At any rate, Java developers will feel right at home.
  5. Google Chrome OS devices will need to get onto the network easily, seamlessly, regardless of Wi-Fi availability. Google really does believe that “the network is the computer”. Without the internet, these devices will be severely hampered. Expect these devices to have multiple network access technologies built in. Wifi hardware will obviously be on board. But you can imagine it also having a cellular transmitter/receiver built-in too.
  6. Remember all that cellular radio spectrum that Google was interested in only one or two years back? Wouldn’t it be just an awesome thing if Google purchased a huge portion of that and used it to make their Google Chrome OS devices be able to instantly jump onto that for network access? You buy the device, punch in a pre-purchased code for access, and your notebook is on the net in 5 minutes! It will be incredibly, insanely easy to get on the network with your Google Chrome OS-powered device.
  7. Hey, what’s that Google Voice project anyway. Only one of the coolest telephony projects around! Maybe Google will leverage this service? Here’s a scenario for you: you buy a Google Chrome OS device, open it up, agree to the terms of a Google voice membership, get a Google voice number and Google account (if you don’t already have one), and the device then connects to the network using the built-in cellular hardware to connect to some of that cellular spectrum that Google will or has already purchased.
  8. After all of this, or perhaps even before this, we all start to feel a little uneasy about just how pervasive Google really is. And despite Google’s mistrust and derision of Microsoft, they begin to look a little bit like Microsoft too…really, really big and really, really powerful and located at every digital turn. But this time, instead of controlling your PC, they control your network. Ooh, there’s a suspenseful novel in there somewhere.

Ok, some of that’s just silly, crazy talk…or is it? We’ll see over the next few months.

Oh, one last thing. I just cannot resist the urge to compare Google Chrome OS to Sun’s Java OS. Do you remember that? I could hardly find any references to it, although I did find an old article called Inside the IBM JavaOS Project. At some point, Sun apparently enslisted IBM to help. At any rate, the Java OS project started (and ended) a long, long time ago. It’s been a decade at least. Remember the Hot Java browser? I actually ran it and used it. I remember that one of our tests at Sun was to run the SwingSet demo on it. But now I’m just distracted. What was I saying? Oh yes, there are even more similarities. Java OS is to Google Chrome OS as the Hot Java browser is to the Chrome browser. Maybe Google Chrome OS will finally be the successful reincarnation of JavaOS?

It’s all fun to think about, and as I suggested, pure speculation at this point.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: JavaFX Tags:

Is the Swing Application Framework necessary now?

March 3rd, 2009 joconner No comments

Although resurrecting the Swing Application Framework (SAF) is a noble and respectable goal, is that even necessary now with JavaFX? If Sun does finalize and fix any remaining rough spots in SAF, is any significant number of developers going to benefit?

Even though I mean no harm or disrespect, someone is bound to view my question as an attack. It’s not. I thought the Swing Application Framework was a great idea. I even spent time writing about and promoting it. But I’m thinking differently these days. I think JavaFX confuses the issue for me.

SAF really is all about making it easier to write Swing application GUIs. The newbie benefits tremendously. Even a veteran benefits because some of the basic boilerplate setup and application structure is already defined. That doesn’t change at all. SAF still fills the void there if you’re going to write Swing applications. For newbies, it’ll get you started in the right direction. For veterans, it might save you some time.

However, most existing applications won’t need SAF. Any of the basic problems that the simple SAF resolves have already been fixed in any existing, big application. The effort to retrofit an existing application to SAF is…well, maybe it isn’t worth it.

More importantly, don’t you really get the feeling that the near and mid-term future of GUIs is JavaFX? Don’t you think the vast majority of Sun resources has been going to JavaFX? I really do. So…any newbie in the world of Java GUIs would probably do best to learn JavaFX, not Swing. Considering Sun’s efforts to push and promote JavaFX for rich GUI apps, JavaFX is really the right place to put your energy right now — especially on new development.

Maybe you don’t buy into JavaFX just yet because of its short history. In that case, go ahead with Swing and the SAF. But…I think any effort put into SAF is for a short-term benefit at this point.

Enough already. I’ve said it. The Swing Application Framework was a good thing, but it didn’t really get the support it needed in the time frame that would have helped its adoption. Resurrecting it now may be a noble goal, but I personally think the people and projects that need SAF the most are now looking at JavaFX.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: Java, JavaFX Tags:

JavaFX Community, let’s do this!

February 15th, 2009 joconner No comments

Not really finding theJavaFX community anywhere else, I’ve created one. Sure, the site itself is ugly as hell now, but that will change…if the community wills it. My intention is that YOU will take this over, you the community, you the JavaFX user.

Here’s what you have from me:

  1. a decent domain name that communicates the purpose pretty well; that’s learningjavafx.org
  2. a community content management system that can support users, forums, blogs, aggregated site feeds, uploads, etc. It’s Drupal. I evaluated others. This works.
  3. a willing host to provide this to the community. That’s me.

I’ll help; I’ll lead; I’ll guide — as much as you want anyway. If you have experience doing this elsewhere, let me know. I’ll let you run a part of the site, moderate a forum, whatever you like. Let me know your interest level, and we’ll figure this out!

The primary purpose I have for the site is a single place for group discussion, articles, blogs, forums — all about JavaFX of course.

Email me at john@joconner.com. Let’s do this as a community.

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: JavaFX Tags: