Mastering JavaFX 10
Build advanced and visually stunning Java applications
Sergey Grinev
BIRMINGHAM - MUMBAI
Mastering JavaFX 10
Copyright 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Amarabha Banerjee
Acquisition Editor: Denim Pinto
Content Development Editor: Gauri Pradhan
Technical Editor: Rutuja Vaze
Copy Editor: Safis Editing
Project Coordinator: Sheejal Shah
Proofreader: Safis Editing
Indexer: Tejal Daruwale Soni
Graphics: Jason Monteiro
Production Coordinator: Shantanu Zagade
First published: May 2018
Production reference: 1290518
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78829-382-2
www.packtpub.com
To my mom, Raisa, and my wife, Irina, without whom this book would have never happened.
To my son, Alexander, who'll learn to read way after this book becomes obsolete.
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
PacktPub.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Sergey Grinev is an experienced software engineer focused on building reliable, quality processes for Java platforms. He started working in this area during his employment with Oracle, where he was responsible for JavaFX testing. For the last few years, Sergey has worked for Azul Systems, assuring the quality of their custom JVMs.
Sergey enjoys sharing his experience: he regularly presents Java conferences, gives lessons, and solves questions on Stack Overflow.
Writing a book is way harder than I thought, and I'm deeply grateful to the people who helped me.
Thanks to my mother, Raisa, who made me study English from the age of 5.
Thanks to my beloved family, Irina and Alexander, for always inspiring me and coping with a half-absent father.
Thanks to my English teacher and friend, April, for the support and inspiration.
Also, great thanks to my editor, Gauri, and the whole Packt team.
About the reviewer
Naman Nigam is a philomath currently working as a software developer with Flipkart. He is heavily involved in gamification and personalization platforms to develop services and features that are responsible for customer engagement at Flipkart. He keeps up to date with the technological upgrades available and their usages, while helping with code reviews, ensuring a consistent performance alongside.
The Flipkart tech team has been extremely helpful during the review process by providing environments where Naman was able to experiment with some of the latest Java releases.
I would like to thank my wife, Neha, who stood by me heedfully whenever I'd take out some time reviewing the book, and my friends who persistently encouraged me to be a part of it.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
JavaFX is a set of libraries added to Java in order to provide capabilities to build a modern UI. It was added to Java a few releases ago, as old librariesSwing and AWTproved to be outdated and too burdened with backward compatibility issues.
JavaFX was designed and developed from scratch to provide Java developers with the capabilities to build modern, rich UI applications with a large set of shapes, controls, and charts. It was designed with performance in mind, is capable of using graphics cards, and is based on the new graphical engine.
In this book, we will study many aspects of JavaFX and go through a large set of examples based on these topics.
Who this book is for
Developers who already use Java and want to add JavaFX to their skill set, students who study Java or computer science and want to use JavaFX to improve their projects, programmers familiar with JavaFX who want to enrich their experience and learn about the new features of the JavaFX 9 and 10 releases.
What this book covers
, Stages, Scenes, and Layout, starts from the essential basis of the JavaFX applicationStage, Scene, JavaFX Event Thread, and the layout graph concept.
, Building Blocks Shapes, Text, and Controls, fills the window we created in the previous chapter with various building blocks provided by the JavaFX API.
, Connecting Pieces Binding, explains that binding is a new method to greatly simplify communication between components.
, FXML, introduces FXML is a powerful tool for building a complex JavaFX UI and separating business logic from UI design. We will design an FXML application and try SceneBuilderan FXML-based UI designer tool.
Next page