All Projects → stevenschwenke → JavaFXWorkshop

stevenschwenke / JavaFXWorkshop

Licence: other
Code and a handout for a JavaFX workshop

Programming Languages

java
68154 projects - #9 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to JavaFXWorkshop

AllInOneFX
All In One JavaFX Application with a curated list of awesome JavaFX libraries, frameworks
Stars: ✭ 26 (+8.33%)
Mutual labels:  javafx, javafx-application
FlatBee
An javafx css style for an flat and smooth experience
Stars: ✭ 24 (+0%)
Mutual labels:  javafx, fxml
find the letter material design
litterature game made using javaFX and FXML, small collaboration, the game is about finding the missing letters from a word using different hints (an image, incomplete word..etc).
Stars: ✭ 21 (-12.5%)
Mutual labels:  javafx, fxml
JFXGoogleDrive
A JavaFX Google Drive Client (For Demonstration Purposes Only).
Stars: ✭ 29 (+20.83%)
Mutual labels:  javafx, javafx-application
Desktop-Applications-JavaFX
JavaFX Open Source Projects
Stars: ✭ 69 (+187.5%)
Mutual labels:  javafx, fxml
Bank-Account-Simulation
A Bank Account Simulation with JavaFX and SQLite back-end. Material UX|UI.
Stars: ✭ 19 (-20.83%)
Mutual labels:  javafx, javafx-application
JetTunes-Desktop-Music-Player
Material design music player made with javafx
Stars: ✭ 36 (+50%)
Mutual labels:  javafx, fxml
Recaf
The modern Java bytecode editor
Stars: ✭ 3,374 (+13958.33%)
Mutual labels:  javafx, javafx-application
mano-simulator
🖥️ An assembler and hardware simulator for the Mano Basic Computer, a 16 bit computer.
Stars: ✭ 20 (-16.67%)
Mutual labels:  javafx, javafx-application
tqrespec
TQRespec - The respec tool for Titan Quest game
Stars: ✭ 59 (+145.83%)
Mutual labels:  javafx, javafx-application
store-pos
It is java accounting software basically developed using javafx which has various modules like purchase, sales, receipts, payments, and journals.
Stars: ✭ 84 (+250%)
Mutual labels:  javafx, javafx-application
sqlbrowserfx
A feature rich cross platform sql client for SQLite , MySQL.
Stars: ✭ 19 (-20.83%)
Mutual labels:  javafx, javafx-application
OmniGraph
Desktop application for creating graphs and algorithm visualisation
Stars: ✭ 27 (+12.5%)
Mutual labels:  javafx, javafx-application
OnlyViewer
A material design picture viewer made with JavaFX and JFoenix. / 用JavaFX编写的Material Design风格的电子图片管理系统
Stars: ✭ 23 (-4.17%)
Mutual labels:  javafx, fxml
Dluid
Deep learning user interface designer
Stars: ✭ 27 (+12.5%)
Mutual labels:  javafx, javafx-application
gramophy
A JavaFX based Open-Source YouTube Music Downloader/Player
Stars: ✭ 88 (+266.67%)
Mutual labels:  javafx, javafx-application
Binding.scala
Reactive data-binding for Scala
Stars: ✭ 1,539 (+6312.5%)
Mutual labels:  javafx, fxml
Jabref
Graphical Java application for managing BibTeX and biblatex (.bib) databases
Stars: ✭ 2,385 (+9837.5%)
Mutual labels:  javafx, javafx-application
InvMan
Open source JavaFX inventory management application
Stars: ✭ 40 (+66.67%)
Mutual labels:  javafx, javafx-application
SnakeFX
Snake game in JavaFX
Stars: ✭ 41 (+70.83%)
Mutual labels:  javafx, javafx-application

JavaFXWorkshop

Shippable status: Build Status

Travis status: Build Status

Meta: About the workshop

The workshop is an internal event for my coworkers. Target audience are developers who haven't heard much about JavaFX and want to know basic concepts and be able to build modern user interfaces.

The code works with Java 7 and Java 8.

Part of this workshop is inspired by Hendrik Ebbers book "Mastering JavaFX Controls" and from his repository at https://github.com/guigarage/mastering-javafx-controls.

Content

  • Building your first FX application: How does JavaFX generally work? What is an fxml-file? What is property binding?
  • Compiling SceneBuilder: Since JDK 8u40, Oracle doesn't provide a binary for the SceneBuilder. This chapter shows you how to compile your own SceneBuilder.
  • Advanced basics: What are tranisitions and timelines? How can I style my application window? What are the pitfalls when using the TableView? ... And a lot of other stuff.
  • JavaFX 3D: What does a 3D application look like?
  • Custom controls: How can I write completely customized components?
  • Testing FX applications
  • SwingInterop: How can FX code be used in Swing applications?

Meta: About JavaFX

  • successor of Swing
  • Swing is dead! (Zombie-mode because for the time being it will be in the SDK)
  • much more features like CSS-styling, rendering using graphic chip, binding, ...

Quick Start: The first chapter in detail

To get a good start in the workshop, I line out the first chapter ("Building your first FX application") in more detail. Read the following and have a look at the code. Then you are ready to go for the more advanced topics.

Part 1: SceneBuilder and .fxml-files

  • .fxml-file = user interface declaration
  • Controller = Java class that controls one .fxml-file
  • don't forget to set the controller in the SceneBuilder on your top component!
  • fields and methods in your controller are bound to the .fxml with "@FXML"
  • just a side note about the lifecycle of a JavaFX application (http://docs.oracle.com/javafx/2/api/javafx/application/Application.html)

The entry point for JavaFX applications is the Application class. The JavaFX runtime does the following, in order, whenever an application is launched:

  1. Constructs an instance of the specified Application class

  2. Calls the init() method

  3. Calls the start(javafx.stage.Stage) method

  4. Waits for the application to finish, which happens when either of the following occur:

the application calls Platform.exit() OR the last window has been closed and the implicitExit attribute on Platform is true

  1. Calls the stop() method

This is our first UI:

alt tag

Part 2: Properties and binding

  • Properties are a language extension - expect them to come around in the backend, too.

  • extension of bean naming convention:

    setMyFoo(...) {...}

    getMyFoo() {...}

    myFooProperty() {...}

  • There is unidirectional and bidirectional binding:

    myProperty.bind(...);

    myProperty.bindBidirectional(...);

  • you can do math with properties, for example: sum.bind(amountOfApples.add(amountOfChips).add(amountOfPotatoes));

  • you can listen on properties and get notified if there's a change

  • great article about difference between ChangeListener and InvalidationListener: http://blog.netopyr.com/2012/02/08/when-to-use-a-changelistener-or-an-invalidationlistener/ (in short: InvalidationListener doesn't give you old and new value and fires even without the data changing. ChangeListener however is less performant.

With properties, we can calculate the sum of the items in our list:

alt tag

Part 3: Charts - the pie chart

  • data behind chart = ObservableList. You can listen on that, too!
  • because of that, you just have to change the data and the chart will be updated

A chart makes our shopping list much more interesting:

alt tag

Part 4: Styling with CSS

  • either directly for one component in SceneBuilder or in the code or in a CSS (you want to have the latter!)

  • behold: not all CSS tags are available in JavaFX and you have to add a "-fx" before them:

    -fx-background-color:red

  • just in JavaFX - CSS: dropshadow

With styling, we now have a realy nice looking shopping list:

alt tag

More resources

Meta: Copyright

All files in this repository are under Creative Commons 4.0 (see http://creativecommons.org/licenses/by/4.0/).

You are free to:

  • Share — copy and redistribute the material in any medium or format
  • Adapt — remix, transform, and build upon the material for any purpose, even commercially.

The licensor cannot revoke these freedoms as long as you follow the license terms.

Under the following terms:

  • Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
  • No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].