JavaFX – Rotate Chart Axis Label

It will be difficult to fit in long labels when they are horizontal. Labels will overlap. So it may be nice to rotate the label by small angle so as to fit long text. We may do this by customizing CategoryAxis. As of now it depends on some internal implementation, but it will be nice to have this feature as part of public API

For Applet mode, click on above image. For standalone mode

Try it out and let me know feedback

JavaFX[1.3] – Power of CSS

There was a question related to setting of background color for TreeView. Yes we can do lot of customization of Controls using CSS. It may be a bit difficult at this point of time due to lack of proper documentation. But you can start playing with CSS using StyleEditor sample.

Below samples shows ListView and TreeView customized using javafx.css file.
Thanks to Jasper Potts for help

For Applet mode, click on above image. For standalone mode

Try it out and let me know feedback
It will be much much easier once the official documentation is in place..

JavaFX [1.3] – TableView (?)

Yes! TableView or Data-Grid is really important control and must be included in JavaFX. If you are really in hurry and can use JavaFX 1.2, you can use XTableView from JFXtras. They are also working on JavaFX 1.3 complaint JFXtras 0.7. If you want it to be part of official JavaFX version, put more pressure on Jonathan Giles

If both these strategies failed, you can still put together TableView using a group of ListView. All foundation for implementing a scalable TableView is already in place based on Cell API.

For Applet mode, click on above image
For standalone mode

Mean while you can use above TableView implementation. View is constructed using a set of ListView. The data model is direct copy of Swing. So didn’t really put any effort for implementing this…

Try it out and let me know feedback.. Please let Jonathan Giles know all your requirements on TableView, so that it will be complete and will address all your requirements when its released

JavaFX [1.3] – TreeView

JavaFX 1.3 has TreeView as preview control. Here I’ll demonstrate how to use it to implement a File Browser. For this, we need to implement a custom TreeView.cellFactory which will return a TreeCell instance (View) and provide an implementation for TreeItem (Model). TreeItem.createChildren is implemented so as to add more and more items, as and when user expands the nodes (Drive/Directory).

For Applet mode, click on above image

For standalone mode

Try all preview controls and give your valuable feedback and file RFEs/Bugs in JavaFX – JIRA

JavaFX + Facebook

One of my previous post discussed about OAuth based authentication for Twitter, LinkedIn and Yahoo. Here I’ll discuss about authentication and usage of Facebook. It also provides OAuth based authentication, but the flow and usage is slightly different. Please refer to Desktop Application Authentication for more information.

For new application, please ensure that you register your application with Facebook. Specify Connect URL as base URL of deployed applet. Note down Application ID which will be used as client_id. Using client_id and Applet URL we can create the authorization URL as shown below.

Authentication Steps:

  • Click on above link and login to Facebook
  • Authorize JavaFX Sample application to access your Facebook profile
  • Page will be automatically redirected to the JavaFX Applet page
  • Extract the access_token parameter from URL
  • Pass access_token to JavaFX Applet as argument
  • Use Facebook Graph API to access all rest of information

Please refer to JavaFXFacebook.html for more information related to extraction and passing of access_token and client_id to JavaFX Applet. The view is implemented using ListView. Please refer to New to JavaFX 1.3: Cells for usage on ListView + ListCell APIs.

Update: There was some confusion due to additional steps related to “redirection of url to applet”. Yes, Twitter, LinkedIn and Yahoo didn’t have this concept. The difference is, there user needs to copy the access_token numbers from the page and paste it in application. In case of Facebook, due to url-redirection, the access_token can be automatically passed to application as argument. So user don’t have to do any copy-paste.

Try it out and let me know feedback

JavaFX [1.3] – Save As Image

JavaFX – Save As Image code updated to be compatible with JavaFX 1.3
Please refer to JavaFX13Utils.fx for more information. You will need to update only if you are using internal APIs as mentioned in this forum thread.

For Applet mode, click on above image

For standalone mode

Try it out and let me know feedback

JavaFX + OAuth

As usual will start off with Wikipedia – OAuth (Open Authorization) – is an open standard that allows users to share their private resources (e.g. photos, videos, contact lists) stored on one site with another site without having to hand out their username and password. With more and more services moving to OAuth model, I think we need to try to have a generic implementation. Here is an attempt…

I prefer not to duplicate all those details available in various resources, so suggest to read few articles if you are not familiar with concepts of OAuth. Yahoo has a very detailed article outlining the flow of OAuth authorization or Beginner’s Guide to OAuth from Hueniverse. Please refer to same for more info..

You can try out yourself with demo below. You need to get consumer-key and consumer-secret from respective service providers – Twitter, LinkedIn or Yahoo

To launch click on above image or

First enter oauth_consumer_key and oauth_secret_key, click “Request Token” button. If key is proper, you will receive a message in log with a URL. Copy and paste that URL in browser and follow the instructions. Once you grant access to your application, it will return a number. Copy the number and paste it as oauth_verifier. Now click on “Access Token” button. It will return you oauth_token and oauth_token_secret which can be used for all subsequent communication.

Yes its a bit difficult to understand the overall flow and implementation. I have tried my best to simplify it. The API may be simplified a bit more. I have signed up for contributing to JFXtras long time back, but haven’t done anything yet. My objective was to pull in the various parsers that are used in different samples and create a library. I think all these can be incorporated into that…


def oauthAPI = OAuthAPI.getInstance(

// Request Token Callback
oauthAPI.onRequestToken = function(response:String: Void {


// Access Token Callback
oauthAPI.onAccessToken = function(response:String: Void {


// Request Token

// Access Token

Refer to LinkedInAPI.fx to get an idea on how we can extend the implementation to have fulll fledged support.

Please try it out and let me know your suggestions and feedback..