Essential JavaFX - Anderson_ Gail.pdf
(
3866 KB
)
Pobierz
164405945 UNPDF
Essential
JavaFX
™
G
AIL
A
NDERSON
• P
AUL
A
NDERSON
Upper Saddle River, NJ
•
Boston
•
Indianapolis
•
San Francisco
New York
Toronto
•
Montreal
London
Munich
Paris
•
Madrid
Capetown
Sydney
•
Tokyo
•
Singapore
•
Mexico City
•
•
•
•
•
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks.
Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations
have been printed with initial capital letters or in all capitals.
Sun Microsystems, Inc. has intellectual property rights relating to implementations of the technology described in this
publication. In particular, and without limitation, these intellectual property rights may include one or more U.S. pat-
ents, foreign patents, or pending applications.
Sun, Sun Microsystems, the Sun logo, J2ME, J2EE, Java Card, and all Sun and Java based trademarks and logos
are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. UNIX is
a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd.
THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL
INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMA-
TION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN
MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE
PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME.
The authors and publisher have taken care in the preparation of this book, but make no expressed or implied war-
ranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or conse-
quential damages in connection with or arising out of the use of the information or programs contained herein.
The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales,
which may include electronic versions and/or custom covers and content particular to your business, training goals,
marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government
Sales, (800) 382-3419, corpsales@pearsontechgroup.com.
For sales outside the United States please contact: International Sales, international@pearsoned.com.
A control number for this work is on file with The Library of Congress.
Copyright © 2009 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054 U.S.A.
All rights reserved.
Printed in the United States of America. This publication is protected by copyright, and permission must be obtained
from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions,
write to: Pearson Education, Inc., Rights and Contracts Department, 501 Boylston Street, Suite 900, Boston, MA
02116, Fax: (617) 671-3447.
ISBN-13: 978-0-13-704279-1
ISBN-10: 0-13-704279-5
Text printed in the United States on recycled paper at R.R. Donnelley in Crawfordsville, Indiana.
First printing, May 2009
Contents
Preface
xi
Acknowledgments xv
Chapter 1 Getting Started with JavaFX 1
What You Will Learn 1
1.1 What Is JavaFX? 1
1.2 The JavaFX Bundle 2
JavaFX SDK 2
NetBeans IDE 3
JavaFX Production Suite 3
1.3 Where to Get JavaFX 3
Create a NetBeans Project 4
Edit JavaFX Source Code 7
Compile and Run 8
Execution Models 9
Chapter 2 A Taste of JavaFX 13
What You Will Learn 13
2.1 Introducing JavaFX 13
2.2 Project GuitarTuner 14
The Scene Graph Metaphor 15
Hierarchical Scene Graph 16
2.3 JavaFX Program Structure 17
Stage and Scene 17
Object Literals 18
iii
iv
Contents
2.4 Key JavaFX Features 19
Type Inference 19
Strings 20
Shapes 20
Sequences 21
Calling Java APIs 22
Extending CustomNode 22
Geometry System 24
Layout/Groups 24
JavaFX Script Artifacts 24
2.5 Making Things Look Good 26
Gradients 26
Color 28
Rectangles with Arcs 29
DropShadows 30
2.6 Doing Things 31
Binding 31
Mouse Events 32
Animations 33
2.7 Source Code for Project GuitarTuner 36
Chapter 3 JavaFX Language 43
What You Will Learn 43
3.1 Variables and Types 43
JavaFX Types 44
Printing Variables 46
Pseudo Variables 47
3.2 Operators 47
Arithmetic Operators 48
Assignment Operators 48
Unary Operators 48
Relational Operators 49
Logical Operators 49
Instanceof Operator 50
3.3 Expressions 50
Plik z chomika:
superktos86
Inne pliki z tego folderu:
Essential JavaFX - Anderson_ Gail.pdf
(3866 KB)
cover.jpg
(31 KB)
metadata.opf
(5 KB)
Inne foldery tego chomika:
Java (2124)
Zgłoś jeśli
naruszono regulamin