Featured Post

Applying Email Validation to a JavaFX TextField Using Binding

This example uses the same controller as in a previous post but adds a use case to support email validation.  A Commons Validator object is ...

Thursday, November 13, 2014

JavaFX Dependency Injection with Google Guice

Since introduced into mainstream Java development by the Spring Framework, dependency injection has been an important part of Java EE development.  This blog post shows how to integrate dependency injection into your Java FX app using a super-lightweight container called Google Guice.

Sunday, November 9, 2014

JNLP BasicService, PersistenceService, and Desktop Muffins

Java provides JNLP downloaded desktop applications with a mechanism to record client-side data called "muffins".  Like their web counterparts "cookies", muffins are intended to store small amounts of data to personalize the application.  While the desktop app may prefer to store all information on the server, muffin saving code is orders of magnitude faster than even a speedy web service or RMI call.

Saturday, November 8, 2014

Handling Command Line or JNLP Arguments in Java

If you have a single option that you'd like to pass with your main(), get it using the args String array (arg[0]).  If you have more than one option, consider using the Commons Cli library.  Commons Cli let's you handle any number of options including those with arguments.  Additionally, the command line will be less brittle because order isn't important.

Some Lambda Expressions in JavaFX

If you've coded Objective-C, Dojo, or jQuery projects, you probably passed around blocks of functionality that are executed when an event occurs.  For example, you might pass in a function for updating a webpage to the dojo.xhrPost() call.

Lambda Expressions are a new Java 8 language construct that fosters this pattern of development.  An equivalent to Lambda Expressions -- Anonymous Inner Classes -- has existed for years and is used widely in Swing and Java FX development.  However, the shortened syntax can make a difficult-to-read block of code (loaded with generics, etc) more understandable.

This post presents a few snippets of code showing the new Lambda Expressions in a JavaFX application.

Sunday, November 2, 2014

JavaFX Cut, Copy, and Paste from a ToolBar

Cut, Copy, and Paste work in JavaFX via the key commands without writing code or configuring FXML.  However, applications provide other means to the Clipboard functionality.  In a previous post, I wrote about adding Clipboard functionality to a MenuBar.  This post describes adding the Clipboard operations to a ToolBar.