Java Reference
In-Depth Information
Listing 1-1. Stub Class
/*
* Generated by JavaFX Production Suite NetBeans plugin.
* CustomLookAndFeelUI.fx
*
* Created on Tue Oct 27 15:19:14 EDT 2009
*/
package org.lj.jfxe.chapter1;
import java.lang.*;
import javafx.scene.Node;
import javafx.fxd.FXDNode;
public class CustomLookAndFeelUI extends FXDNode {
override public var url = "{__DIR__}CustomLookAndFeel.fxz";
public-read protected var okButton: Node;
override protected function contentLoaded() : Void {
okButton=getNode("okButton");
}
/**
* Check if some element with a given id exists and write
* a warning if the element could not be found.
* The whole method can be removed if such warning is not required.
*/
protected override function getObject( id:String) : Object {
var obj = super.getObject(id);
if ( obj == null) {
System.err.println("WARNING: Element with id {id} not found in
{url}");
}
return obj;
}
}
Listing 1-1 shows the class CustomLookAndFeelUI that extends FXDNode . When this node is
instantiated, the variable okButton points to the node that represents the layer, which was named
jfx:okButton . Once this stub class is created and used in the application, the designer can feel free to
update the look of the dialog panel and submit her changes without developer intervention. If the
designer changes the name of the okButton, a warning will be generated when this class is instantiated.
This warning creates a contract between the designer and developer that will help catch errors between
the two workflows.
When working with Eclipse or another IDE that does not yet support the creation of these stub files,
you can create them by hand or just use NetBeans to create them and copy them into your IDE of choice.
Search WWH ::




Custom Search