Beginning JavaFX (eBook)
XVII, 336 Seiten
Apress (Verlag)
978-1-4302-7198-7 (ISBN)
The open source JavaFX platform offers a Java-based approach to rich Internet application (RIA) development-an alternative to Adobe Flash/Flex and Microsoft Silverlight. At over 100 million downloads, JavaFX is poised to be a significant player.
Written by a JavaFX engineer and developer, this book is one of the first on the JavaFX platform to give you the following:
- The fundamentals of JavaFX scripting on desktop and mobile platforms
- Examples of RIAs using JavaFX Graphics
- Media and animation using JavaFX
See how JavaFX gives you dynamic Java effects in your RIA development.
A. Lawrence Prem Kumar has more than 5 years of experience in Java and J2EE. Since 2005, he's worked for Sun Microsystems. Presently, he is working on Java FX, focusing particularly on Java FX graphics.
The open source JavaFX platform offers a Java-based approach to rich Internet application (RIA) development-an alternative to Adobe Flash/Flex and Microsoft Silverlight. At over 100 million downloads, JavaFX is poised to be a significant player. Written by a JavaFX engineer and developer, this book is one of the first on the JavaFX platform to give you the following: The fundamentals of JavaFX scripting on desktop and mobile platforms Examples of RIAs using JavaFX Graphics Media and animation using JavaFX See how JavaFX gives you dynamic Java effects in your RIA development.
A. Lawrence Prem Kumar has more than 5 years of experience in Java and J2EE. Since 2005, he's worked for Sun Microsystems. Presently, he is working on Java FX, focusing particularly on Java FX graphics.
Title Page 1
Copyright Page 2
Contents at a Glance 4
Table of Contents 5
About the Authors 14
About the Technical Reviewer 15
Acknowledgements 16
Introduction 17
Chapter 1: Introduction to RIA 18
The History of RIA 18
Key Characteristics of RIA 19
RIA Workflow 19
Why RIA 20
Some RIA Examples 22
Summary 24
Chapter 2: Introduction to JavaFX 25
Why JavaFX 25
Advantages of JavaFX 25
History of JavaFX 26
The JavaFX Platform 27
The Developer Bundle 27
The Designer Bundle 28
Standalone 28
JavaFX Platform Integration: The Bigger Picture 29
JavaFX Mobile: An Introduction 30
Advantages of JavaFX Mobile 30
Deployment and Distribution 31
Getting Started 32
What to Download 32
Writing Your First JavaFX Application 32
Running Your Application Using NetBeans 37
Standalone Mode 37
Browser/Java Web Start Mode 38
Mobile Emulator 41
Running the Application from the Command Line 43
Compiling the Application for Standalone Execution 43
Compiling the Application for Browser/Java Web Start Execution with JavaFX Packager 44
Building and Running the Application Using JavaFX Packager for the DESKTOP Profile 44
Building and Running the Application Using JavaFXPackager for the MOBILE Profile 45
Comments 46
Summary 47
Chapter 3: Data Types 48
Variable Declaration 48
var vs. def Declarations 49
Variable Naming 49
Reserved Keywords in JavaFX Script 50
Variable Declaration Syntax 50
Data Types 51
String 51
Integer 54
Decimal Number 54
Hexadecimal Number 54
Octal Number 55
Number 55
Boolean 56
Duration 57
Typecasting 58
Sequences 59
Default Values for Data Types 60
Summary 61
Chapter 4: Operators and Expressions 62
The Assignment Operator 63
The as Operator 64
Arithmetic Operators 65
The Modulus or Remainder Operator 66
The Arithmetic Assignment Operator 66
Operator Precedence 67
Unary Operators 67
The Increment and Decrement Operators: ++ and -- 68
The Unary + and – Operators 69
The not Operator 70
Relational Operators 70
Logical Operators 71
Range Expressions 74
Block Expressions 76
Looping Expressions 77
While Loops 81
Break Expressions 81
Continue Expressions 82
The if-else Expression 83
Exception Handling 85
The new Expression 86
Differentiating Expressions 87
Summary 88
Chapter 5: Functions 89
How a Function Works 91
A Function with Neither an Argument nor a Return Value 91
A Function with Arguments but Without a Return Value 92
A Function Without an Argument but with a Return Value 93
A Function with Arguments and a Return Value 94
Variable Access within a Function 95
Script-Level Variables 95
Local Variables 96
Function Overloading 96
Recursive Functions 97
Anonymous Functions 98
The run() Function 100
Command-Line Arguments 101
Summary 103
Chapter 6: Class Definitions 104
Classes and Objects 104
Classes 104
Objects 105
Features of OOP 105
Data Abstraction 105
Encapsulation 105
Inheritance 105
Polymorphism 105
The Class Definition 106
Creating Object Literals 107
Initializing Class Attributes within an Object Literal 108
Calling the Members of the Class 108
Assigning Default Values to Data Members 110
The init Block 110
Order of Instance Initialization 112
The postinit Block 112
Modifying Class Objects 112
Objects as Function Arguments 113
Non-Member Functions Accessing the Object 114
Static Members 115
Sharing a Function Name Between Script-Level and Member Functions 117
Calling a Java Method That Is a JavaFX Reserved Word 118
The abstract Class 119
Summary 120
Chapter 7: Access Specifiers 121
The Script—The .fx File 122
The Script-Private Access Specifier 123
Packages 127
Statics in JavaFX Script 129
The package Access Specifier 130
Package Access with Class Members 133
Honoring Access Specifiers for Java Classes 135
The protected Access Specifier 136
The public Access Specifier 139
JavaFX Secondary Access Specifiers 143
public-read 143
public-init 146
Secondary Specifiers and def 148
Access Specifiers for Class Definitions 148
Script-private Classes 149
Package-accessible Classes 149
Protected Classes 150
Public Classes 151
Summary 151
Chapter 8: Inheritance 152
The Order of Initialization of Data Members 153
Overriding Data Members 154
Use of the super Keyword 155
Mixin Classes 156
Creating a Subclass from Multiple Mixin Classes 159
The Order of Initialization in Multiple Inheritance 160
Abstract Classes 161
Using a JavaFX Class to Extend a Java Abstract Class 162
Anonymous Implementation of Java Interfaces 163
Summary 164
Chapter 9: Data Binding 165
What Does Binding Mean? 165
Recalculation of Expressions 167
Binding with Conditional Expressions 168
Binding with for Expressions 169
Binding Block Expressions 171
Binding Functions 172
Bound Functions 174
Binding with Object Literals 175
Bidirectional Binding 179
Lazy vs. Eager Binding 182
Summary 184
Chapter 10: Sequences 185
The sizeof Operator 186
Accessing the Elements of a Sequence 186
Nested Sequences 187
Creating a Sequence Using a Range Expression 188
Excluding the End Value in the Sequence 189
Sequence Slicing 189
Using a Predicate to Create a Subset of a Sequence 190
Working with Sequences 191
Inserting an Element into a Sequence 191
Deleting an Element from a Sequence 192
Reversing a Sequence 194
Sequences as Function Parameters 194
Binding with Sequences 196
javafx.util.Sequences Utility Functions 197
Summary 198
Chapter 11: Triggers 199
Defining a Simple Trigger 199
A Trigger with Access to the Old Value 201
Using Triggers with bind 202
Implementing Binding Using Triggers 203
Validation Within the Trigger 205
Sequence Triggers 206
Nested Triggers 211
Summary 212
Chapter 12: Introduction to JavaFX UI Elements 213
Rendering Model: Immediate Mode vs. Retained Mode Rendering 214
Scene Graph 214
Scene 215
Stage 216
Coordinate System 216
Graphical API Summary 217
Node – The Base UI Element 218
Geometries 220
Stroke vs. Fill 220
Stroke Attributes 220
Writing your First UI 222
Paints 230
Solid Colors 230
Gradients 232
Linear Gradient 232
Radial Gradient 238
Input Handling 240
Keyboard Input 241
JavaFX Focus Sub-system 241
Mouse Input 242
BlocksMouse 243
Text Rendering 244
Image Rendering 248
Loading an Image 248
Rendering an image 254
Transformations 256
Translation 256
Rotation 259
Custom Node 261
Scaling & Shear
Controls & Layouts
StyleSheets 270
Charts 270
Effects 273
Bounds 273
Bounds Class 273
Node Bounds Variables 274
Summary 277
Chapter 13: Introduction to Animation 278
What is Animation? 278
Animation in JavaFX 278
Play, Pause, or Stop a Timeline 283
KeyFrame Attributes 285
KeyFrame.action 286
KeyFrame.canSkip 286
Simplified Syntax 291
Transitions 292
Path Transitions 293
Scale Transitions 298
Rotate Transitions 300
Translate Transitions 300
Fade Transitions 300
Parallel and Sequential Transitions 306
Summary 310
Index 311
Erscheint lt. Verlag | 31.12.2010 |
---|---|
Zusatzinfo | XVII, 336 p. |
Verlagsort | Berkeley |
Sprache | englisch |
Themenwelt | Informatik ► Programmiersprachen / -werkzeuge ► Java |
Mathematik / Informatik ► Informatik ► Theorie / Studium | |
Mathematik / Informatik ► Informatik ► Web / Internet | |
Schlagworte | Animation • Flash • Internet • Java • JavaFX • Rich Internet Application • Silverlight |
ISBN-10 | 1-4302-7198-1 / 1430271981 |
ISBN-13 | 978-1-4302-7198-7 / 9781430271987 |
Haben Sie eine Frage zum Produkt? |
Größe: 8,6 MB
DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasserzeichen und ist damit für Sie personalisiert. Bei einer missbräuchlichen Weitergabe des eBooks an Dritte ist eine Rückverfolgung an die Quelle möglich.
Dateiformat: PDF (Portable Document Format)
Mit einem festen Seitenlayout eignet sich die PDF besonders für Fachbücher mit Spalten, Tabellen und Abbildungen. Eine PDF kann auf fast allen Geräten angezeigt werden, ist aber für kleine Displays (Smartphone, eReader) nur eingeschränkt geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.
Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich