jeudi 27 septembre 2012

Put it all together (JavaFX 2.x Custom component, FXML, JAX-RS 2.0 client API)

In my last post, I wrote about how to make custom component compatible with FXML and how to use it in an application.
Before that, I had tested the client API of JAX-RS 2.0 (with JSON and XML serialization).
And now, when I’m putting them together, I can write a small JavaFX 2 application which consumes REST services.

lundi 18 juin 2012

JavaFX 2.x custom component compatible with FXML


In November, last year, I wrote a little example on how to extend an existing component in JavaFx 2.0.
Today, I would use this component in FXML and make a little demo.
The application for the demo is very simple:
  • One SearchTextBox component (custom component) with events on OnCrossButtonMouseClicked and OnSearchEvent.
  • One ComboBox to change the font size of the SearchTextBox component.

mercredi 23 mai 2012

RESTful client in Java with JAX-RS 2.0 Client API (JSON update)


When I wrote RESTful client in Java with JAX-RS 2.0 Client API, I thought that JSON serialization/deserialization was not working with Jersey 2.0-m3.
But, in fact, it works as designed and Martin Matula gives us the solution in his second comment and in JIRA).
To use the JSON serialization/deserialization (with Jersey 2.0m3), you have to:
  •  enable the JsonFeature on the client with the line:
    client.configuration().enable(new JsonFeature());
  •  and add the jars:
    jersey-media-json-2.0, jackson-jaxrs, jackson-core-asl, jackson-mapper-asl and jackson-xc

jeudi 10 mai 2012

RESTful client in Java with JAX-RS 2.0 Client API


On october 21th 2010, I wrote a RESTful client in Java. We are now in 2012, and the next version of JAX-RS (the 2.0 and which will be included as part of Java EE 7) will include a client API.

The JAX-RS 2.0 specification is still work in progress, but a few implementations already exist (in beta or in the first milestones).

To begin to explore the JAX-RS Client API, I decided to use the Jerseyimplementation (which is the JAX-RS's reference implementation) and the same RESTful service that I used in RESTful client in JAVA.

jeudi 17 novembre 2011

Extend an existing UI component in JavaFX 2.0


Last year, I coded a custom component on JavaFX 1.x, then naturally I wished to rewrite it on JavaFX 2.0.
To do this, i tried different solutions,  like creating to a totally new component with this method
But, it isn't a great solution when you want to customize or to enhance an existing component, like I want to do.
To rewrite my custom component, I chose to extend an existing control (TextField in my case) and its skin, because you cannot add content directly in the control but you can do that in its skin.


jeudi 4 août 2011

A very simple example using FXML (JavaFX 2.0 b37)

update August 05, 2011: cleaner code and runs in b38.
This example is a very simple JavaFX application using FXML. It could certainly be improved, but it's just enough to begin to play.

vendredi 22 juillet 2011