15
INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Embed Size (px)

Citation preview

Page 1: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

INTRODUCTION TO JAVAFX

CS12420 – Software DevelopmentAndrei Stanica(modified ltt)

Page 2: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Overview

What is JavaFX History Why use it JavaFX or Swing/AWT Examples

Page 3: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

What is JavaFX

A media/graphics framework for creating GUIs in Java applications

Based on Swing and AWT More powerful Used to create both desktop and web

applications Like Swing draws its own components, less

communication with OS Lightweight and hardware-accelerated Makes use of FXML – new XML-based mark-

up language for defining UIs

Page 4: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

History

First announced in May 2007 by then Sun Microsystems

Released in December 2008 Originally brought as a response to Flash

and Shockwave But also to improve ease of creating

GUIs for Java applications Latest release is JavaFX 2.2

Page 5: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

History

With the latest release Oracle added numerous features: Linux and Mac OSX support Multi-touch events and gestures Image manipulation easier with built-in API Bundled with Java SE 7 update 6 Big number of new and enhanced UI

controls, charts and containers Many more…

Page 6: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Why use it

Page 7: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Why use it

Page 8: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Why use it

Oracle provides you with JavaFX Scene Builder Visual UI design tool No need to spend n-hours anymore on trying to

move a button a little bit to the left Ability to apply CSS on the components of

the UI opens a door for better looking applications that are more attractive to the end-user

Soon 3D support (possibility of games cropping up) and iOS and Android support promised by Oracle

Page 9: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

JavaFX Script and FXML

Before version 2.0, JavaFX made use of JavaFX Script

JavaFX Script – proprietary scripting language – deprecated

Page 10: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

JavaFX Script and FXML

From 2.0 onwards, FXML has been introduced More powerful and XML-based All developers have knowledge of XML

FXML – declarative XML-based language

Page 11: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

JavaFX or Swing/AWT

Less

IDEs provide support for GUIs in Swing but in FX this is provided by Scene Builder which is part of distribution

Page 12: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

JavaFX or Swing/AWT

More

This is Scene Builder running

Page 13: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

JavaFX or Swing/AWT

GUIs are created a lot faster than in Swing and AWT

More sophisticated and aesthetically pleasing UIs

Easy integration of sounds, images and videos and of web content

Code is simplified in JavaFX by separating the UI from the logic of the application

JavaFX can be integrated in Swing applications, allowing for a smoother transition

Page 14: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Examples

Demonstration of JavaFX (use chrome) http://www.oracle.com/technetwork/java/

javafx/samples/index.html

Java SE 7, JavaFX, JavaFX Scene Builder and examples to get you started can be found here: http://www.oracle.com/technetwork/java/

javafx/downloads/index.html

Page 15: INTRODUCTION TO JAVAFX CS12420 – Software Development Andrei Stanica (modified ltt)

Other Useful Links

http://docs.oracle.com/javafx/2/overview/jfxpub-overview.htm description

http://docs.oracle.com/javafx/2/api/index.html API