Java Reference
In-Depth Information
disabled = true;
WipeReplace.doReplace(displayed, notDisplayed, doAfter);
disable: bind disabled;
var burnButton = Button{
text: "Burn Transition"
action: function(){
disabled = true;
BurnReplace.doReplace(displayed, notDisplayed, doAfter);
disable: bind disabled;
Stage {
title: "Chapter 3"
scene: Scene {
width: 640
height: 480
fill: Color.BLACK
content: [
spacing: 10
translateX: 25
translateY: 30
content: [fadeButton,slideButton,flipButton,wipeButton,burnButton]
function doAfter():Void{
var temp = notDisplayed;
notDisplayed = displayed;
displayed = temp;
disabled = false;
The stage contains a scene with a VBox , which contains the buttons and the node— nodeA . The nodes,
nodeA and nodeB, represent the content that we will be switching in and out as the buttons are pressed.
The variables displayed and notDisplayed record which node is displayed or not; thus when nodeA is
visible, the variable notDisplayed points to nodeB . After each transition, the values of displayed and
notDisplayed are switched to reflect the content of the scene. This business of tracking which node is
displayed or not is a sort of bookkeeping that facilitates this demonstration. Other applications that use
these transitions may or may not keep track of the visible content in this way.
The code in Listing 3-2 is the implementation of the example class ExampleNodeA . This code is also
not critical to the transitions themselves, but provides a somewhat realistic demonstration. The
implementation of ExampleNodeB is very similar to that of ExampleNodeA , but I'll leave it to you to look to
the source code for the details.
Search WWH ::

Custom Search