Audio equalization
audioSpectrumInterval property, 371, 375
audioSpectrumListener property, 371
audioSpectrumNumBands property, 371, 374, 375
audioSpectrumThreshold property, 371
BAND_COUNT constant, 371
bucket calculation, 374
createBucketCounts method, 374
createEQBands method, 371
createEQInterface method, 369
equalizer and button styling, 379
equalizer bands creation, 369, 371
EqualizerBand.MAX_GAIN constants, 371
EqualizerBand.MIN_GAIN constants, 371
equalizerview constructor, 376–377
equalizerview mediaplayer listener, 376
frequency spectrum display, 372
normArray, 374
setNextHandler Method, 377
setValue method, 372
Slider value property, 371
SpectrumBar controls, 372
spectrumDataUpdate method, 375
SpectrumListener class, 373, 374
Bindings utility class
equals() method, 113
overloaded add() methods, 110
relational operators, 113
selection operators, 113
triangleareaexample.java, 111–112
BorderPane Class
bound function, 155
create score boxes function, 154
createBackground(), 155
createScoreBoxes() function, 154
properties, 153
reversi root stage declaration, 153–154
title, background, and scores, 155
Cascading style sheets, 51
changeOfScene.css, 61
id property, 60
nodes styling, 60
onTheScene.css radio button, 60
Colorful Circles application, 431
Event Dispatcher Thread (EDT), 255
Fluent Interface API
Boolean property and binding, 114–115
doubleproperty and doublebinding, 118–119
floatproperty and floatbinding, 117–118
if/then/else expressions, 121–122
integerproperty and integerbinding, 116
longproperty and binding, 116–117
objectproperty and objectbinding, 119
stringproperty and stringbinding, 119
FXML
Cat Adoption Form application, 472
controlling applications, 473, 474
Dog Adoption Form, 468
FXMLLoader, 469
GroovyFX code, 471
JavaFX application, 468
layout constraints, 471
ObservableList inline, 471
Pet Adoption application, 469–470
properties, 471
GStreamer, 335
Hello Earthrise
clipping graphical areas, 16
image displaying, 13
user interface, 11
IntelliJ Community Edition, 441
JavaFX
AnchorPane
alignment and stretching properties, 165
child Node constraints, 165
game and restart nodes, 166
list of children, 165
restart() method, 166
sizing behavior, 165
stand-off, 165
top-right corner,restart button, 167
custom square region
functions, 157
padding property, 157
preferredWidth/Height properties, 158
properties, 156
read-only properties, 157
single reversi square, 159
wrapper script, 159
dynamic layout techniques
bind layouts variable, 142
BorderPane Class (see BorderPane Class)
CenterUsingStack extends Application, 144
createScore method implementation, 150–152
DropShadow and InnerShadow, 152
first falf player score, 149
getScore and getTurnsRemaining, 149
getTurnsRemainingMethod, 149
HBox, VBox, and FlowPane, 150
horizontally sized window,ouput, 152
implement player score backend, 149
location and size binding, 142
overlay and align nodes, 144
per-layout or per-node basis, 145
player color, 148
prefWidth and prefHeight, 143
scene centering text, 142
score, 148
setAlignment functions, 144
SimpleIntegerProperty, 149
StackPanes and TilePanes (see StackPanes and TilePanes)
text node, 143
textOrigin property, 143
tileWidth and tileHeight, 150
turns remaining, 148
vertically sized window,output, 152
GridPane layout
ALWAYS, 163
hgrow and vgrow, 163
like-named static method, 162
nested StackPane, 164
NEVER, 163
on node properties, 162
SOMETIMES, 163
tiles method implementation, 164
Hello Earthrise, 7
clipping graphical areas, 16
image displaying, 13
user interface, 11
Java enterprise modules, 393–394
Java SE 6 Update 10, 2
layout techniques
binding, 167
bind vs. layouts, 168
complexity, 167
performance, 167
More Cowbell program (see More Cowbell program)
Oracle's official JavaFX web site, 4–5
PieChart
abstract Chart class, 312
clockwise configuration, 315
CSS to style, 315
fx-pie-label-visible property, 316
getChartData() method, 311
layout instructions, 314
modified chart,output, 313
modified version, 312
rendering,TIOBE index, 310, 311
start() method, 314
stylesheet, 314
TIOBE index screenshot, 309
resizable reversi piece
constructor code, 160
public ReversiPiece() method, 160
reversi square, 162
side-by-side playing pieces, 160
SimpleObjectProperty, 160
styling, 160
WHITE or BLACK, 159
wrapper application, 161
Reversi to life
addEventHandler method, 177
application, 140
black's first turn, 175
canFlip method, 173
cells loop to go through, 173
custom binding, 173
enumeration class, 141
EventHandler inner class, 177
game rules, 172
highlight animation,active cell, 178
initBoard() method, 141
Java singleton pattern, 140
next move by white, 139
opposite() method, 141
owner enumeration, 141
region class function, 176
ReversiModel class, 140
ReversiSquare create() method, 175
static model variable, 174
tiles() method, 174
turn-based game, 138
two-dimensional array, 141
3D scene graph
classes and methods, 169
3D look and feel, 169
orthographic projection, 170
perspective transform layout, 172
PerspectiveCamera to transform, 171
slick-looking perspective, 171
source co-ordinates mapping, 170
3D translation or rotation, 170
Tiles() Method, 171
scene.media package., 344
screenshot, 3
script language, 3
SDK, 6
tools, 7
user interface control (see StarterApp program)
XYChart
alternativeColumnVisible properties, 324
alternativeRowFillVisible properties, 324
behavior,xAxis, 321
getChartData method, 321
NumberAxis, 322
properties, 316
rows and column,fill values, 325
title and named symbols, 322
xAxis constructor, 320
JavaFX 2.0, 4
media classes, 344
properties and bindings
bindings utility class (see Bindings utility class)
Fluent interface API (see Fluent interface API)
JavaFX Beans (see JavaFX Beans)
key interfaces and concepts (see Key interfaces and concepts)
script language, 94
SimpleIntegerProperty class, 94
JavaFX Beans
eagerly instantiated properties strategy, 126–130
getter and setter methods, 125
lazily instantiated properties strategy, 130–132
JavaFX concurrency framework
Service<V> Abstract Class
executor, 278
restart() method, 278
starting up, ServiceExample, 284
task cancelled, 286
task progress, ServiceExample, 285
task succeeded, 285
task threw exception, 286
Worker.State.CANCELLED state, 278
Worker.State.RUNNING state, 284
Worker.State.SCHEDULED state, 278
thread identification, 255–257
unresponsive UIs
call() method, 275
cancel() methods, 269
CANCELLED state, 269
exception property, 267
FutureTask<V> class, 268
InterruptedException, 276
java.util.concurrent.ExecutorService, 265
java.util.concurrent.FutureTasks, 265
long-running event handler, 261
message property, 267
Model nested class, 274
Platform.runLater() method, 266
program, 264
progress property, 267
protected methods, 268
public static boolean isFxApplicationThread(), 266
public static boolean isSupported(ConditionalFeature), 266
public static void exit(), 266
ResponsiveUIExample.java, 265
RunnableFuture<V> class, 268
running property, 267
RUNNING state, 269
RuntimeException, 276
shouldThrow field, 274
state property, 267
starting up,WorkerAndTask, 274
task cancelled,WorkerAndTaskExample program, 277
task progress,WorkerAndTaskExample program, 275
task suceeded,WorkerAndTaskExample program, 276
task threw exception, 277
Task<V> abstract class, 268
Thread.sleep(Long.MAX_VALUE), 265
title property, 267
totalWork property, 267
UnresponsiveUIExample.java, 261–266
updateProgress() call method, 269
value property, 267
workDone property, 267
Worker.State, 268
WorkerAndTaskExample.java, 269–274
JavaFX Groovy
advantages, 440
API enhancements
binary zip release, 442
built-in data structure syntax, 440
closures, 440
dynamic typing, 440
getter/setter access, 440
Groovy Class creation dialog, 444
Hello GroovyFX code, 444
IntelliJ, 441
jar references, 443
jfxrt.jar, 444
landing page, 440
module configuration screen, 443
named constructor parameters, 440
operator overloading, 440
source files, 440
JavaFX languages and markupvanishing circles application, 431–433
code, 432
functionality, 433
Groovy, 435–436 (see also JavaFX Groovy)
Scala, 436–438 (see also Scala)
swing, 432
Visage, 438–439 (see also Visage)
FXML (see FXML)
JAXB.unmarshal method, 410
JsonFactory.createJsonParser method, 405
Key interfaces and concepts, 94–97
readonlyproperty, 101
type-specific specializations, 105–109
writableValue interface, 101
Media classes
audio clips
BasicAudioClip application, 339
constructor, 337
getResource method, 337
media.css style sheet, 338
MediaView, 344
play method, 337
playback parameter control, 339–340
source code, 337
stop method, 337
URI string, 336
wrap-up, 343
audio playing
AbstractView Base Class, 353
acceptTransferModes method, 355
audio equalization (see Audio equalization)
AudioPlayer3 application class, 355–356
code, 345
createControlPanel method, 363
createPlayPauseButton method, 364
currentTime property, 356
DragEvent handlers, 354
error handling, 346
formatDuration method, 366
initSceneDragAndDrop method, 354–355
jar file, 345
JavaFX FileChooser, 350
MediaPlayer wrap-up, 379
play, pause, and stop, 356
playback controls creation, 359–362
PlayerControlsView Class, 353
position slider changes, 366
repetition, 368
seekAndUpdatePosition helper method, 364
seeking, 366
updatePositionSlider method, 365
volume control, 367
GStreamer, 335
media formats, 335
video playing
audioplayer conversion, 388–390
functional movie player, 380
http URL, 380
mediaviews slide apart, 388
robot movie, 381
split and join transitions, 387
StackPane, 380
Metronome1 example program
MetronomeTransitionMain.fx, 74–76
timeline-based, 72
More Cowbell program
Audio Configuration Program
behavior of, 22
AudioConfigModel, 26
colors and gradients, 27
graphical node, 26
slider node, 27
Observable collections
observableList
addListener() calls, 236
boolean wasAdded(), 243
boolean wasRemoved(), 243
FXCollections.observableArrayList(), 236
getAddedSize() method, 237
getAddedSublist() method, 237
getFrom() method, 237
getPermutation(int i) method, 237
getRemoved() method, 237
getRemovedSize() method, 237
java.util.List interface, 232
JavaFX observable map, 243
K getKey(), 243
key interfaces, 232
ListChangeEventExample.java, 238–240
MapChangeEventExample.java, 244–247
MapChangeListener interface, 243
MapChangeListener.Change class, 243
next() and reset() methods, 237
ObservableListExample.java, 233
ObservableMap<K, V> getMap(), 244
onChange() callback method, 236
register and unregister ListChangeListeners, 232
remove() method, 234
removeAll() call, 242
setAll() method, 240
sort() utility method, 240
UML diagram, 232
V getValueAdded(), 244
V getValueRemoved(), 244
wasAdded(), 237
wasPermutted(), 237
wasRemoved(), 237
wasReplaced(), 237
factory and utility methods, 248–254
OnTheScene program
screenshots, 50
animation, 464
closures, 463
ScalaFX
code, 453
core functionality, 457
default project settings, 455
Hello ScalaFX application, 457
IDE installation, 454
implicits, 457
installation, 455
library, 453
proxies and implicit conversions, 458–459
Scala project creation, 455
semicolons, 457
stub class, 456
TypeSafe, 453
StackPanes and TilePanes
layout methods, 146
node alignment example, 148
pos enumeration, 147
snapToPixels property, 148
versatile class, 146
visual effect, 145
StarterApp program
accordion creation, 208
Accordion/TitledPane tab, 185, 186
createTabs() method, 195
createToolBar() method, 195, 197–200
file menu, 184
graphic and an accelerator key, 197
graphic() method, 197
items() method, 206
keyCombination() method, 197
onAction() event handler, 197
onSelectionChanged() method, 204
popup, 191
screenshot, 184
ScrollPane/Miscellaneous, 187–190
separator, 202
SplitPane/TreeView/ListView, 186
StarterAppMain.java file, 194–195
tableView, 185
row selection, 207
titledpane definition, 208
toggle buttons, 201
toolbar, 185
treeitem
changelistener, 211
checkbox, 218
contextmenu, 221
definition, 211
hyperlink, 219
listview creation and assigning, 212
passwordfield, 223
scrollpane definition, 213–218
slider, 224
splitmenubutton, 222
splitpane creation, 212
webview tab, 192
Swing and SWT applications
ActionListeners, 291
display.asyncExec(), 295
EventQueue.invokeLater(), 287
FXCanvas code, 299
FXPanelBuilder class, 287
JavaFX hybrid program, 291
javafx.embed.swt package, 295
JavaFXSceneInSwingExample.java, 291–294
javax.swing.JComponent, 287
JFXPanel class, 287
Label widget, 299
NoJavaFXSceneInSWTExample.java, 295–298
org.eclipse.swt.widgets.Canvas, 295
paint()and getPreferredSize()methods, 289
ResponsiveUIExample program, 287
SWT JavaFX hybrid program, 300–303
SWT Shell, JavaFX rectangle, 303
Timeline, 64
controlling and monitoring, 70–71
pause() method, 71
properties, 69
resume button, 71
Start() method, 71
stop button, 71
Transition classes
controlling and monitoring, 77
MetronomePathTransition Example, 77
behavior, 78
MetronomePathTransitionMain.java, 78–79
properties, 76
User interface creation
stage setting, 36
bounds, 47
checkForCollision() method, 88–89
close() method, 50
CSS (see Cascading style sheets)
cursor setting, 57
desktop, 48
drag and drop handlers, 62
drawing rounded rectangles, 47
ellipse drawing, 80
event handling, 62
focused property, 49
full-screen mode, 47
handle() method, 91
intersects() method, 89
key event handlers, 62
KeyEvent Class, 62
lookup() method, 59
Metronome1 example program (see Metronome1 example program)
mouse event handlers, 62
nodes, 58
OnTheScene program (see OnTheScene program)
program arguments, 46
resizable method, 46
scene, 50
scene class property, 59
scene's content sequence, 59
stage class understanding, 36–37
StageCoach example program (see StageCoach example program)
style setting, 46
timeline class (see Timeline)
transition classes, 71–72 (see also Transition classes)
VBox layout class, 49
ZenPong program (see ZenPong program)
Z-Order, 49
advantages, 465
bidirectional bindings and lazy bindings, 533–535
bind expression
bind keyword, 530
block, 532
compiler, 530
dependent variables, 531
for expressions, 531
function invocation expression, 532
if expressions, 531
object literal expressions, 533
characteristics, 477
class definitions
member variables, 560
abstract instance function, 569, 571
inheritance, 566
instance function override, 568
instance variable override, 567
mix-in classes, 565
superclass, 565
code organization feature
public-init and public-read modifiers, 582–583
data types, 478
expressions
assignment operator, 515
block expression, 513
compound assignment operators, 516
for expression, 519
precedence and groupings, 514
separator, 514
types, 512
variable and constant declarations, 514–515
function definitions
dequeue() function, 542
enqueue() function, 542
Fibonacci series, 536
function parameters, 543
instance functions, 536
integer value, 536
local variables, 543
parameter types, 539
script functions, 536
script variables, 542
call stack, 551
Hello Visage application, 466
Java libraries
classes and interface extending, 597–599
classes instantiating, 594
enums access, 597
Java methods calling, 595
keywords quoting, 596
native array type, 599
nested classes access, 596
object fields access, 595
static fields access, 595
object literals
classes and objects, 523
constant and variable declarations, 525
declarative syntax, 529
default instance variables, 524
instance variable and functions, 525–526
instance variables initializer, 523
Java object creation, 529
Visagedoc, 523
package contents, 466
primitive types
byte, short, and long types, 485–486
characteristics, 480
double types, 488
float and number types, 486–488
reflection
instance and script variables, 605–607
metaprogramming, 600
mirror-based reflection, 600–601
mirrorOf() methods, 601
VisageLocal, 601
sequence
delete expression, 507
element accessing, 504
element insertion, 506
explicit sequence expressions, 501
insert expressions, 507
reverse operator, 506
size accessing, 503
string format specifications, 589–592
triggers
old and new values access, 584–586
sequence modification information access, 586–588
variable modification, 583
variable
declarations, 478
names, 479
types, 479
var keyword, 478
visagec compiler, 467
wrapper, 467
Web service access
frontend and backend platforms, 391–392
JavaFX and Java enterprise modules, 393–394
REST
"firstName" string, 421
asynchronous processing, 413–417
boilerplate code, 420
CellFactories, 419
DOM approach, 409
firstNameProperty() method, 421
getObservableList() method, 398, 410
hard-coded tweets, 400
HTTP protocol, 395
human-readable text format, 400
import statements, 409
JavaBean properties, 412
JSON library, 403
Json response, 401
JsonFactory.createJsonParser method, 405
key-value map, 407
ListView.setCellFactory() method, 399
manual XMLParsing, 412
parseTweet method, 406
POJO Tweet class, 421
PropertyValueFactory, 420
RSS response, 401
searchterm, 400
setCellValueFactory method, 419
simple data binding, 407
SimpleStringProperty, 419
TableColumn constructor, 418
timeStamp field, 412
TweetApplication retrieving JSON data, 405
tweets rendering, 397
Twitter REST API, 403
TwitterResponse class, 412–413
uniform resource identifiers, 395
unmarshalling, 410
XML parsing and JAXB, 410
XmlAccessType.PROPERTY, 422
XML-based operations, 408
XML-based response, 408
zero-arg constructor, 397
SOAP, 395
ZenPong program, 63
initial state, 80
keyFrame action event handler, 88
3.21.21.47