Tuesday Jun 30, 2009

If you're a Mac user and access javafx.com pages with embedded applets,, such as the JavaFX samples or documents on the Learn page, you may have noticed a new warning popping up, even for applets you've run before:

Unrestricted access dialog box on Mac

This new dialog box is appearing because Apple has changed to a site/URL-based security model in one of its recent Java updates. You can keep this message from popping up repeatedly by selecting the checkbox that says Allow all applets from "javafx.com" access.

Monday Jun 29, 2009

Here's a quick-and-easy video player written in the JavaFX Script programming language. First, place your video clip into the same directory as this source code. Next, edit the code in red (clip name, scene with, and scene height) to match your particular video. Finally, compile and run the program. Clicking on the screen will pause/unpause playback.

Step 1: Add Import Statements

import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.paint.Color;
import javafx.scene.media.*;

Step 2: Define Media-Related Variables

def vid = "{__DIR__}video-clip.flv"; // CHANGE AS NEEDED

var isPlaying = false;

def myMediaPlayer = MediaPlayer {
        media: Media {source: vid}
}

def myMediaView = MediaView {

    onMousePressed: function(event){

        // take action
        if(isPlaying){
            myMediaPlayer.pause();
        }else{
            myMediaPlayer.play();
        }

        // toggle play state
            isPlaying = not isPlaying;
    }

    mediaPlayer: myMediaPlayer
}

Step 3: Render Player

function run(){
    Stage {
        title: "JavaFX Video Player"
        scene: Scene {
            width: 800 // CHANGE AS NEEDED
            height: 600 // CHANGE AS NEEDED

            fill: Color.BLACK
            content: [myMediaView]
        }
    }   
}

Friday Jun 19, 2009

I've written 4 blog articles on the JavaFX sequence implementation that should be of interest to those who want to know how it works and what it costs.  This covers the 1.2 Marina implementation.

This is probably the best order to read them:
http://per.bothner.com/blog/2009/JavaFX-sequence-basics/
http://per.bothner.com/blog/2009/JavaFX-unboxed-sequences/
http://per.bothner.com/blog/2009/JavaFX-sequence-updating/
http://per.bothner.com/blog/2009/JavaFX-sequence-triggers/

Wednesday Jun 10, 2009

First look - download JavaFX 1.2 to preview. Test this newest version of the JavaFX 1.2 SDK for yourself and tell the world what you think. Post a blog about the features you like most or describing your experience using JavaFX and enter for a chance to win $500 or a $25 amazon.com gift certificate. 


Tuesday Jun 09, 2009

Technically I'm on vacation this week so don't mention this post to my boss. I simply couldn't wait to blog about cool stuff we put into JavaFX 1.2. Shhhhh!

Lots of JavaFX related things were announced at JavaOne, many of them concerning future products and other bits that aren't released yet. This post won't cover any of those. There were so many things discussed at JavaOne that I'm afraid some of the key points of the new JavaFX might have been missed. In this post I'm only going to cover the things that you can actually download and work with today. I'm talking only about the new version of JavaFX, previously codenamed Marina, and now called JavaFX 1.2. Without further ado, here is my personal list of the most important features.

Top 5 Most Important Features in JavaFX 1.2

Linux and Solaris support

Support for JavaFX under Linux and Solaris has been a long time coming. It's always been in our continuous build system and we really wanted to ship it with the 1.0 release, but too many things were broken. Finally, after much hard work, we have a beta release. Our goal is to make Solaris and Linux equal platforms with Windows and Mac in the JavaFX world. JavaFX is about having one Java across all of the screens (Desktop/Mobile/TV) as well as all of the OSes (Mac/Win/Linux/Solaris). This is one more step towards that goal.

Some features still don't work, which is why we are calling it a beta release, but it's a good starting point. We are now using GStreamer for the video support, which was one of the key features previously missing. You will get some graphics hardware acceleration depending on your distro and configuration. Shaped windows do not work yet. This is due to a bug in the underlying JRE. The graphics guys say they have a fix which will be rolled out into Java 6 and OpenJDK soon, so you won't have to wait until the next release of JavaFX for cool rounded windows.

[screenshot]

Controls and Layout

JavaFX has had great graphics but at the 1.0 release had only a single native UI control, TextBox. It's kinda hard to make a real business oriented application using only text controls. That's all changed now. JavaFX 1.2 has real UI controls, designed for the 21st century. We looked at everything we always loved and hated about Swing, and considered long term UI toolkit trends. Then we build a new control and layout API that addresses the kinds of applications people need to build today. Here's just a taste of what's in the new controls:

  • All controls are skinnable with CSS, so a designer can create a common look across all of your applications.
  • There is a new modern default look and feel, Caspian, designed to look at home across OSes and on mobile devices
  • Controls are in the common profile, meaning they will work on all devices, not just desktops.
  • New controls for standard features like progress indicators and the hyper link
  • All built on top of the JavaFX scene graph, so there are no remnants of AWT.

Along with the controls is a new layout system that addresses the biggest problems with the AWT layouts. It is now super easy to mix layout with animation, and to create custom layouts using only a few lines of code. With controls we can build real business applications that run across multiple screens.

There are a few controls missing from the current list. In particular you will notice the absence of Table and Tree. It's not that we don't have plans for them. There simply wasn't enough time and we didn't want to hold back the release. Rest assured they are coming.

PreviewScreenSnapz001.png
PreviewScreenSnapz002.png

Charts

Along with controls the most important feature for building business applications is charts. Charts are such a common request that we built them into JavaFX. All of the standard chart types are there, including pie, scatter, and bar charts. They are very easy to use and customize. You can also create your own chart types using a few lines of code. Here's a few examples.


Data: Persistence, RSS/Atom, and Tasks

Previously you could work with data only by dropping down to Java code. This would be fine except for the fact that mobile Java code is different than desktop Java code. In addition, every form of Java has it's own special API for persisting data. To fix this problem we've added new support to JavaFX common profile to hide these kinds of platform differences and let you get back to coding great apps. Here's a quick list of the new stuff:

  • javafx.io.Storage for persisting data locally on any client platform
  • javafx.data.feed.* built in support for RSS and Atom data feeds
  • DateTime, Math, and Properties as JavaFX classes
  • javafx.async.* base classes for all asynchronous operations in JavaFX, including a clean way to implement Java based tasks

Speeeeeeed

Our goal is for every updated to JavaFX to be faster, and I think we definitely hit that goal. Across the board you will find JavaFX 1.2 to be faster than 1.1 and 1.0. In terms of startup time, memory usage, and graphics performance we have improved every part of the JavaFX user experience. For certain tasks you will see as much as a 3x improvement over the previous release.

To achieve this speed improvement we revisited almost every part of the platform. The compiler switched from using true multiple inheritance to mixins. This eliminates most of the nasty corner cases that gave multiple inheritance a bad name while providing what developers want 90% of the time. As a side benefit the underlying compiled bytecode is smaller and faster.

The graphics team did a lot of work redesigning the scenegraph to handle updates to the scene more intelligently. The result is fewer repaints and a more responsive user interface.

There were also bug fixes across the board to the video & audio stack and the underlying graphics pipeline. In addition, we put a lot of work into JavaSE 6 update 14 to reduce startup time and improve webstart performance. Over all you will find JavaFX 1.2 to be faster and smoother than the previous releases.

SafariScreenSnapz021.png

Just the beginning

The five features I listed above are just a small part of the many improvements in JavaFX 1.2. What's most important is this is part of a larger plan to have regular smaller releases of the JavaFX platform rather than the huge 2+ year release cycles of the JRE. Faster and smaller releases ensure that we ship high quality software to you faster, and lets us better incorporate your feedback. If there is any feature you feel is missing please send us a note or file a bug at javafx-jira.kenai.com.

Back to vacation for the week and then time to dive into the next release. Please let us know how you like JavaFX 1.2 and what you are are building with it.

Wednesday Jun 03, 2009

If you are interesting in trying out JavaFX running on a real phone, we are offering HTC Diamond handsets preloaded with JavaFX and a couple of sample applications for sale at the show in the JavaOne Store.  Click here for Peter Pilgram's (one of the Java Champions) AudioBlog on this subject!

Wednesday May 27, 2009

One of the important features of JavaFX is its ability to load and manipulate rich graphics coming from professional designer tools such as Adobe Illustrator or Adobe Photoshop. This is possible by using JavaFX Production Suite for exporting graphics from the designer tools to FXZ format and then by loading and manipulating the graphics from by classes in the javafx.fxd package. For example stuff from the screenshot below - graphics like we used for the demo of the JavaFX Production Suite for the JavaFX launch event back in December 2008. 

 Photoshop exporting JavaFX

The team delivering the JavaFX Production Suite will be at JavaOne and will be doing a session session "Getting the Most from the Designers with JavaFX Production Suite" and a BOF "Quo Vadis JavaFX Production Suite". The session is aimed more at beginners and intermediate JavaFX developer and will focus at the introduction, basic usage and feature overview of the JavaFX Production Suite, whereas the BOF will be more about advanced and upcoming features. We would like to also use the BOF as the platform to hear feedback from you! Both sessions will have many cool demos with stuff you never shown in public before, including new features of 1.2 and stuff  we are preparing in our kitchen for the upcoming releases (and I can tell you it is pretty wild stuff, think about stuff like animations, audio, interactivity ...)

You can come to see as at the session: 

  • ID#: TS-5494
  • Title: Getting the Most from the Designers with the JavaFX™ Production Suite
  • Date: 02-JUN-09
  • Time: 04:40 PM-05:40 PM
  • Venue: Moscone
  • Room: North 124

and at the BOF:

  • ID#: BOF-5493
  • Title: Quo Vadis JavaFX™ Production Suite
  • Date: 02-JUN-09
  • Time: 07:30 PM-08:20 PM
  • Venue: Moscone
  • Room: North 124  

 

See you all there!

JavaFX Production Suite Team 

Thursday May 07, 2009

The JFXStudio has launched a new micro challenge: Small World Sound The twist on this one is that the entries must incorporate a set of graphics and sound provided for the contest. I's an fun collection of artwork so this should make the entries quite interesting. Why don't you show the world what you can cook up?!

I recently did an interview with the excellent web technologist, Scott Hanselman, on his podcast Hanselminutes. He happened to be in Eugene, Oregon (where I live) presenting to our local .NET user group so I invited him to a local pub for burgers and beer. Afterwards we sat down to chat about RIAs, JavaFX, and the battle to be The VM on the web. You can find the interview on his website or iTunes.

Sunday May 03, 2009

JavaFX.com now has a set of resources that can help you craft a better look and feel for your JavaFX applicaiton. 

Image, Color Schemes, Fonts, Sound Effects and Music and Icons - galore !! Check it out ! 

Hello, 

 In this past week the Application Showcase on the  JavaFX.com community page has featured 

This and other applications received some good press. In addition Raghu writes about creating a tool tip for a node and another twist on webservices and maps based apps, can be seen on Vaibhav's blog post

 

Friday May 01, 2009



We now have JavaFX contents in Brazilian Portuguese .  The language family now consists English, Japanese, Korean, Simplified Chinese and Brazilian Portuguese.  Simply click on the [Change] link at the bottom of JavaFX.com  and you can select a language of your choice. 

Tuesday Apr 28, 2009

JavaFX Application Examples Link to Gettting Started with JavaFX tutorial Link to Media Browser tutorial Link to button rollover effect techtip Link to animated line graph article Link to Transparent Window sample Link to calculator sample

Sometimes it seems that all the world's a Java developer--but I'm not. I am Nancy Hildebrandt, a technical writer at Sun Microsystems, and I have more of a scripting background.

If you're new to JavaFX, and especially if you're new to Java too, here's a learning trail you can follow. Feel free to take shortcuts and move around in the list. The fastest way to learn is to keep trying and changing the JavaFX Script code yourself.

I recommend installing NetBeans IDE with JavaFX, since it has quite a bit of JavaFX help built in, plus an error-checking device that alerts you to problems in your code.

  1. Build a very simple application of your own from scratch in the NetBeans IDE, such as creating a screen with simple text or one or two objects. If you get stuck, move ahead to the following steps to get more information.

  2. Work through the following tutorials, in the following order.
  3. Look at some of the articles and tech tips on the JavaFX Learn page. Each article and tech tip has an assigned level of Beginner, Intermediate, or Advanced. Here are the current articles and tech tips for beginners: New articles and tech tips come out every week, so keep checking the Learn page.
    Download the application when provided in the article, and make changes to it in the NetBeans IDE. Sometimes it's easier to figure out the purpose of an object when you can see what effect it has when you run the application.

  4. Consult the following reference documentation:
    • JavaFX API documentation, especially the Master Index to look up information on individual classes or variables.
    • JavaFX Language Reference: Although it's still in draft form, there's some good information you won't find anywhere else.
    • Google searches (or any other search engine): there are lots of Web sites and blogs that have information about JavaFX.
  5. Look at some of the JavaFX samples, especially some of the ones that extend what you have already learned, such as the following:

Thursday Apr 16, 2009

Over the past few weeks, we've posted two articles describing how applets written in the JavaFX Script programming language can interact with JavaScript code in the pages that contain them.

The first article , written by Sun engineer Ken Russell, describes this JavaFX Script - JavaScript bridge. It covers the technical details of calling from JavaScript into JavaFX Script and vice versa. In this article you will learn how to set variables, invoke functions, descend into the scene graph, show documents in a web browser, and more.

The second article, written by Sun technical writer Scott Hommel, renders a set of 2D dice, with values that are set by the containing JavaScript. This short tutorial walks the user through the application development process, covering additional considerations to make when using the javafxpackager tool.

Tuesday Apr 14, 2009

Last week, two of our JavaFX technical writers, Irina Fedortsova and Alla Redko, attended the Sun Tech Days in St. Petersburg, Russia. Here they report on the JavaFX activities at the event.

Irina:

This year, I attended the Sun Tech Days for the third time. My overall positive impression was brightened with two presentations on JavaFX technology. Yes, it seems like it's been just recently that Sun revealed its plans regarding JavaFX and look, here it is! Probably because I have been working on documenting the JavaFX technology, I listened to the speakers with a sort of personal involvement. I paid attention to every detail. I noticed how quickly the seating capacity of the conference hall was exhausted and how deep and tricky the questions were after the presentation. I heard positive comments whispered by the listeners while the demos, which were really cool, were being demonstrated. I think it was the cool demos that inspired further discussions among the participants who chatted about applications they could develop with the JavaFX Script language.

On the last day of the conference, which was the University Day, I assisted in conducting the JavaFX seminar for students. Once again, I was impressed with the quality of questions asked by the students during the Q&A session. Those who attended the seminar quickly grasped the ideas and advantages that JavaFX brings to their coding experience.

Alla:

This year is my third time attending and working for the Sun Tech Days conference. I suppose we've been generously compensated for the rush with last-minute reviews of every content piece developed for the conference either in Russian or in English. I really enjoyed the welcome atmosphere of the booth zone, where the JavaFX booth was undoubtedly the hottest one.  It was also very rewarding to see how many developers are interested in the emerging technology. For instance, the first presentation about JavaFX attracted so many visitors that some of them even had to stand. What I'm particularly proud of, is that the JavaFX Learn page and other doc resources were a "must have" reference in almost all presentations about JavaFX.

The JavaFX seminar we worked on together with training representatives proved that JavaFX technology draws huge interest among students and professors. Amusingly, most of the attendants had not registered for the seminar. They came after talking to Sun engineers at the JavaFX booth, listening to presentations about JavaFX, or attending the JavaFX Master Class. This is how adoption works!