Modern Java Clients with JavaFX @ Denver Java User Group Meetup – 2021

October 3, 2021

< 1 min read

Modern Java Clients with JavaFX – The Definitive Guide.
This session is for professionals building Java applications for desktop, mobile, and embedded devices in the Cloud age. It will help you to build enhanced visual experiences and to deploy modern, easy to maintain, client applications across a variety of platforms.

View Slides Here


Stephen Chin

Senior Director of Developer Relations

Stephen Chin is Senior Director of Developer Relations at JFrog, author of Raspberry Pi with Java, The Definitive Guide to Modern Client Development, and Pro JavaFX Platform. He has keynoted numerous Java conferences around the world including Oracle Code One (formerly JavaOne), where he is an 8-time Rock Star Award recipient. Stephen is an avid motorcyclist who has done evangelism tours in Europe, Japan, and Brazil, interviewing hackers in their natural habitat and posting the videos on When he is not traveling, he enjoys teaching kids how to do embedded and robot programming together with his teenage daughter.

Video Transcript

welcome um
to tonight’s denver java and boulder
java users group
i’m greg ostrovich and we’ve been doing
combined meetings
uh since covid and continuing just to
meet online we hope to meet again
in person once everything’s figured out
we’re always looking for djug and b jug
speakers so let us know
email matt rabel or myself or
hit us up through the meetup group and
let chris weiner know as well
if you’re interested in speaking um we
want to do some housekeeping
and then we’ll introduce the speakers uh
the speaker
um for starters if you need the restroom
hopefully you can find it wherever
you’re watching this from
tech systems is usually our food sponsor
and we appreciate their support
tonight’s dinner is sponsored by
whatever’s in your pantry and whatever’s
in your fridge
and uh shout out to courtney alterman c
elterman at uh you can
reach out to her
if you need to uh if you have some
hiring needs uh they’re a sponsor and we
appreciate their support
jfrog is another sponsor they’ve been
doing some awesome giveaways
you can scan the qr code or use the
bitly link it should be in the
chat box to enter their drawing
apex systems is another sponsor they’ve
been sponsoring the beer
they’re a staffing agency braden kollip
is one of their uh
one other our my main contact main point
of contact
uh but tonight’s uh beers or other
beverages are sponsored by whatever’s in
your beer fridge or your fridge
uh tonight i’m trying uh not your
father’s root beer and it’s it’s
pretty good another sponsor is develop
they give away uh access to pluralsight
ace uh then one seal is one of our main
points of contact i work for the state
of colorado and we’ve started to use
pluralsight we’re doing a kind of a test
with it
and it’s really rich and it’s really
kind of cool i had no idea how amazing
it was
i haven’t been using it and it’s i would
recommend it so
we think uh developed intelligence for
sponsoring us
and for doing that uh drawing and
they’re always looking to hire
uh technical instructors who specialize
in several technologies
for contract opportunities those include
golang javascript react devops stuff
like kubernetes and docker
and many others you can reach out to bob
clary or to jarrett
amazon is another sponsor and they’re
hiring all sorts of stuff full stack
so reach out to them and we thank chris
almond and sam ayer
at amazon for their sponsorship
of our java users group another sponsor
is octa
they sponsor the meetup site and this
online meeting that matt
does for us and we really appreciate
that so reach out to them if uh
for if you have any needs especially i
know they have an awesome oauth
a ability that you can code through
their stuff in fact uh
my mother-in-law used to work for a
company that was using that and it was
really cool
i was like oh i know who i know who
works on that uh
nextgen is another sponsor they’re a
staffing agency as well
uh beth crowley is our main contact
point for that
and uh the last i heard they were
looking for a full stack
mid to senior java developer with
experience and so reach out to them
their website is listed
oh uh we have a new contact i guess um
dana eslin so that’s really great we
appreciate their support
another contact another supporter of the
java users group and of the boulder java
users group
is venkat’s romanian he has agile
it’s a website and then in addition to
training through that
he will be putting on a conference it
was postponed because of covet concerns
and i’m sure they’ll ramp that up and
they were having an amazing number of
speakers at that conference it was
looking really good
another sponsor is jetbrains we give
away an intellij
ide but you could use it’s it’s really
rich you could use
java python ruby there’s all sorts of
stuff so
a lot of things are available through
that and we thank
jetbrains for their giveaway every every
month for years they’ve been doing it
with us and it’s been awesome
um for door prizes uh mike zueto will
handle that for us i know he does some
stuff behind the scenes to make that
we also have uh i want a big shout out
to the board
for the djug that helps uh helps us put
this on
i just talk in front of you guys and
uh all the hard work is done by matt
rabel who gets the speakers the
when we meet in person and does the
uh mike’s weirdo who does the door
prizes and works with the sponsors
and zetty chin fong who does all of the
operational stuff including social media
announcements and other other stuff so
with that i’m going to bring up
chris weiner from the boulder java users
so that they can thank their sponsors as
good evening everyone of course we’re
also thinking tech systems
they’re probably america’s foremost
technical recruiter
and we work with anastasia alexenko a
really smart personable person
if you want to check in and find out
what’s going on in in the space
she’s a great person to chat with uh
we’re also very thankful normally
before and after covid we meet at rule 4
security and emerging technologies they
were last year’s
colorado technology association award
winner and this year’s uh i think they
won this year’s
ceo award no fluff just stuff
j j zimmerman they provide world-class
uh venkat subramaniam of course
intellij jet brains and o’reilly books
thanks greg
back to you thanks chris
all right so before we introduce our
featured speaker
i’m going to introduce uh gear chan
wilenga who’s going to tell us all about
the fuji
framework i’m really excited to hear
about this so dear chad
thanks a lot so i’m going to just show
my screen
so hi everybody my name is gertian i’m
in amsterdam in the netherlands
and it’s 1 30 in the morning down here
um and um you know i’d really like to
thank you all for
for attending this session um
especially because the reason why um
why we’re here is because um we’re doing
jug tour and we are fuji
and that’s what i want to briefly uh
talk about so fuji is a new
community platform a community site
um if you were around back in the day is
similar to as we used to have
so what we have on the fuji site
is all the information that you need to
do your daily java development work
whether you’re a beginner in java or
whether you are
some advanced java developer needing
tips and tricks and insights and so on
so for example
with all the different quarterly updates
um coming out all the time
do you know what fixes are actually in
those updates
so on fuji you can see um per
quarter and then per release
what fixes have gone into those
updates and also you can vote on them so
what we want to um end up with
is a dashboard view with
all the favorite fixes of the community
you go in here either in the old issues
view or in the component view
you’ll browse through the these
different issues here
and that have been fixed for that
particular release in that particular
um so first of all just to inform
yourself of what’s actually happened
and it’s really hard to tell what’s been
going on with java
over the different updates because there
are so many of them who can keep track
so that’s what fj is for and as you read
through these
and and you go from here into the actual
issue itself and read more about it
and sort this based on priority and so
on you might find some that you find
interesting and then you will vote on
and based on your votes um those items
end up on the highlights page
and the ones that in them on the
highlights page are the ones that we
within the fijian community provide
commentaries on
so we see um on the highlights page
uh for example back in april last year
um that there are fuji commentaries here
so for example
if a fish if an issue is named something
like integrate marlin renderer project
you would have no idea automatically
what that means and so we add a
did you know that jdk9 switched to using
the higher performing myelin renderer
and this is a back port of that feature
to jdk8
so we want to add analysis on top of
all of these different fixes that have
gone into these different updates
so not only do you see what’s gone into
the updates but also
you get some analysis that fuji provides
so that’s one aspect of what
fuji is for another aspect is command
line arguments
do you know what all the different
command line arguments are for java
do you know what’s new across different
now chris newland a java champion has a
wonderful site called and his content has
been integrated
by him into fuji um so fuji is really
an integrated community platform that
brings in different resources from
different places
another example is mark huffman also a
java champion
who has a very nice site called java
on which you can see the different open
jdk distributions because
not only is it not so easy to keep track
of all the different updates
not so easy to keep track of all the
different open jdk
distributions either
what does java mean right now you know
it’s not just oracle java of course
there’s all kinds of different
open jdk distributions and also javas
that are not based on the open jdk
and so that is the information that is
collected together here on the java
version almanac
integrates it into fuji so those are the
key services that fuji provides right
the view onto the updates a
view onto the command line arguments and
onto the different open jdk
distributions then in addition there is
a blog so either you can reuse
your existing blog content here um
as matt has done and steve will be
or you can write um completely new
um directly here what you’ll find is a
lot of pretty well-known people
from the java community and also less
well-known people
we want to really provide this as a
platform for
new people to the java community as well
as those who have been around for a
while so to get a nice mixture
and you might ask yourself who is behind
all of this
where does this come from it’s really a
community driven
information site with a board consisting
azul datadog datastax
jfrog payara and sneak and
those are the organizations behind it on
board but in fact anyone can get
there is of course a slack channel so on
the slack channel
is where we decide what gets posted on
the fuji blog so on food jay today
every day there is a new article so you
can see this is from today and then
march 9th yesterday and so on all the
way back there’s different
categories of content and you could
a community manager for a particular
category so for example
in the tools area there’s a whole
section on intellij
driven by helen scott from jetbrains
and there’s a devops section
driven by people from jfrog because
they’re experts in the devops area
in the java community so there’s this
matching of
organizations and individuals to their
um running particular parts of um
of fj so in the security area for
um clearly a leader in the java area
in security is sneak and brian vermeer
from sneak
is the community manager for the
security parts of
fuji so every
monday morning what happens is that we
what will be published that week on fuji
and we’ve we’ve been posting one a day
a week or two ago we had so much content
that was still fresh and relevant that
we posted
two a day for a week there’s more and
more content coming in
and it’s all on the wordpress so it’s
it’s not ideal but it works it’s good
enough it does the job
if you want to be involved and provide
you can get credentials to put your
content up there or we can do that
and finally there is a twitter handle
and we would love for you to follow us
on twitter and when you do that
you will get at least once a day a tip
or trick or insight
about a new article or something new
going on
in the java community and this will
result in a newsletter and and and other
integrations so one could imagine for
example stack overflow the
the java parts of stack overflow also
being integrated into
fuji so that we as a community can
really end up with a one-stop shop
for everything related to java that’s
with 3j
and what does fujia stand for what does
it mean well the letters here
are a friend of open jdk
so the j is from jdk and we’ve added the
a and the y to make it clear
how to pronounce it which gives us a
bird so
um with fuji what we have is a place
for friends of open jdk anyone using
java in any way at all is welcome to
participate in one way or another either
checking it out and taking a look and
following on twitter or by
contributing content and leading parts
fuji yourself that’s the story of fj
please join in and enjoy the session
thank you very much that was awesome i
appreciate that
so let me go ahead and bring up uh next
our speaker tonight um it’s going to be
our talks on
javafx which is really interesting years
ago at the
java users group we’ve had a couple of
speakers on javafx
and i remember at the time it was
supposed to be kind of a replacement of
or a competitor of adobe flash which has
since i think got away
so i’ll be i’m really interested to see
what’s current on that and what you
would use it for
uh in in the java framework for stuff
that we need to do
so tonight’s topic is modern java
clients with javafx the definitive guide
this session is for professionals
building java applications for desktop
mobile and embedded devices in the cloud
it will help you to build enhanced
visual experiences
and to deploy modern easy to maintain
client applications across a variety of
these applications can take advantage of
the latest user interface components
3d technology and cloud services to
create an immersive
visualization and allow high value data
learn how to leverage the latest open
source java client technologies to build
responsive and modern user interfaces
from the authors of the definitive java
client reference
um tonight’s speaker is steve chin uh
stephen chin is
the senior director of developer
relations at jfrog
author of raspberry pi with java the
definitive guide to modern client
and pro javafx platform he has
keynoted numerous java conferences
around the world including oracle code
formerly java one where he is an eight
rockstar award recipient uh stephen is
an avid motorcyclist who has done
evangelism tours in europe
japan and brazil interviewing hackers in
their natural habitat and posting the
videos on
uh when he is not
traveling he enjoys teaching kids how to
how to do embedded and robot programming
together with his teenage daughter
you can find him on twitter at steve on
and without further ado let me bring up
steve chen thank you for joining us
cool thanks very much for the intro greg
and it’s a pleasure to be able to speak
at the
the denver jug um actually the last time
i was out in denver i was doing kids
workshops together with um
with matt and melissa who who do the
denver um kids who code program so that
that was awesome um i think it’s devoxx
devoxx for kids program
so that was that was awesome and um
super excited to
see all the folks in chat so i have the
chat up on one of my
many monitors so thanks for saying hi
random guy i’m going to answer your
question in just a sec so hang in there
so if you have questions as i’m going
through the presentation feel free to to
ask them and make this as interactive
as possible um i don’t know about you
guys but
um a year ago when when we first heard
about um
the the virus and what was going to
happen um i i kind of pictured that
um it would be this this sort of
apocalyptic scenario and this this would
this would be the sort of life which
which we’d all be going through
um kind of on the road
um maybe maybe having our our dog in tow
and um going down the highway and you
know foraging for food now
unfortunately this this isn’t reality in
the pandemic
and i think instead what what most of us
have ended up doing
is um something equivalent to to this
so um this is this is me on a typical
day and
and yes i i do work in a bathrobe i i’d
highly recommend it
why put pants on when you can be super
um i have three monitors i have a video
set up
um and i have a a super plush red chair
which you can you can also see behind me
as well
so um i i think that we’re very
fortunate as developers to
to be able to continue our livelihood
and do the sort of great development and
coding and work which we do
um straight from our home so um
you know i think we’re very fortunate in
that and hopefully we’re all
gonna have this all be behind us and
i’ll actually be able to meet you all in
in denver sometime in the in the near
okay so random guy has a question about
the raffle so
in the top right corner you see where it
show notes um if you go to that url this
denver jug is listed on the show notes
page and that’s where the
raffle for one of our super cool prizes
is so i’m gonna if you if you’re anxious
go there now otherwise i’ll have more
info about the raffle later in the
okay and then um this is a brief history
of javafx um and
i guess i’m kind of dating myself by
going all the way back to
2006 but this was when the original f3
forms follow function was
written and built by chris oliver
and he he kind of packaged this this
entire solution
um it was it lets you build user
interfaces and a custom scripting
it’s out on top of pico2d which actually
was an open source project i was helping
out with at the time
and it ran on top of the java runtime
and lets you build really rich
client experiences with a um
a really seamless language and platform
and chris
chris’s demos were awesome where he’d
basically take
any website um which was professionally
and in minutes he’d be able to rebuild
into javafx with better
animations and graphics and a better
um more powerful programming language
behind the scenes
this when c beyond got acquired by sun
back in 2008 this is when javafx 10 came
as the initial release of javafx
technology so
um this this was um
okay i can’t see emotes in the chat but
that’s that’s i’m sure that’s awesome
so um when javafx first came out
um it was something which basically
brought this great platform
and then it lets you do this directly on
top of the java platform
one of the big challenges with it was
you had to learn a new
language like the jobx javafx script was
implemented as a proper
scripting language kind of like groovy
or scala or
closure and as a result you had to learn
an entirely new language to code
javafx which they removed
when 2011 and went straight to java apis
which actually brought a lot of
popularity to the language in java2o
further bundling it with javasc update 6
was again
a great move so now you just came with
the jdk by default
and finally was fully integrated with
jdk and javafx 8.
unfortunately somebody at oracle pushed
the kill switch back in um 2018
and removed it from the jdk but but like
any good
technology this wasn’t enough
to keep javafx down and
i don’t think you’re getting the audio
on this but of course arnold’s saying
i’ll be back which is exactly what
to javafx with the return of javafx
supported by gluon so gluon is a
company in belgium but what they do
is they provide consulting and
professional services for javafx and
they took on
both open jdk work for javafx so they
have released javafx for java
11 12 13 14 15 and 16 and they even have
a preview
release for java 17 yes jonathan were
we’re all pretty old um and then also
scene builder which in my opinion is the
best way to get started with javafx
is a great gui builder for doing all
this stuff on the desktop
and of course you can run javafx on ios
and android now as well
which is the future of javafx so running
javafx on mobile
is really the way to go forward so i’m
going to give you a quick demo
of how to build your your first javafx
application but before that
some more details on what we’re offering
um for a raffle for this presentation so
as i mentioned if you go to the show
notes site or you scan the url
um you will get today’s slides of course
you have to take notes
a video of this talk which will post
right after the recording’s done
and we’re raffling off a baby yoda lego
set so this is um ari who
is our community manager and supports
all the java user groups that jfrog
this is one of his personal favorite
sets i know um
and it’s it’s awesome for even if you
don’t like it your kids will love it so
uh we’re raffling off one of these
only for folks who came to the talk
tonight so um go to the raffle
there is a check box to opt in for
marketing communication but if you don’t
check that you’re still entered in the
um so you can also just enter the raffle
and not receive any spam communication
from us if you don’t want to
okay so back to the talk i think the
starting place for javafx for everybody
is really scene builder and so what
scene builder is
is it’s a drag and drop rapid
application development environment
it was built by the awesome team in
who was with sun and oracle and just did
um user experience work to create one of
the best
um gui builders available i i definitely
know this is better than
than what most people have to deal with
because i had to help my daughter with
with her ielts class over the summer and
using the apple tools to to build uis
um for ios was quite a pain that was
that that’s something which you
shouldn’t wish on your worst enemy to
actually have to use that for
professional development but scene
builder is actually
a pleasure to use and in the left it
gives you all the available
containers and controls it gives you a
full tree view of your entire document
you get a preview where you can drag and
drop and build things
and then full property editing and
another nice thing about the
architecture of scene builder
is you can use it on real applications
because it
generates an fxml file
which is entirely separate from your
code and you use a controller in your
code to integrate with your code base
but what this allows you to do is it
allows you to
have a clean separation of your your
model and your view
okay so let me let me quickly switch to
scene builder and give you all
a a live demo of this
okay and let me try sharing um his
streamy art
all right i think i got it um okay so
this is what the scene builder user
looks like welcome carl glad to have you
we’re having quite the
the author meeting here between um past
and present
um javafx authors so something
something also to note and i’ll talk
about this a bit later
is um a press actually is going to do an
for our java modern clients with javafx
which we released um just just a little
bit over a year ago
and so we’ll have an update of that for
java 17. so i think it’s awesome also
that um
not only the javafx community but also
publishers and folks are really getting
behind javafx as the
the future of client development okay so
here’s here’s what scene builder looks
you um as i mentioned you can see all
the controls in the top left and then
drag and drop them right in
um so we can we can pick maybe a um
let’s grab a button pop it into the view
and then on the right are all the the
and as we edit this this will edit in
you can directly edit styles and sizes
see exactly what it’s going to look like
when it when it gets run
and then in general javafx does a great
of um allowing you to use css and then
style things separately so
if um if you want to entirely change the
look of buttons or the look of different
components which you’re
you’re editing you can do that entirely
straight from css and um
separate not only your your model from
your code but also your design
your styles from your model from your
code so i have colleen separation of
here’s a label and then you can even do
complicated stuff like
like list views and media and images and
all sorts of great stuff
so it allows you to mock up stuff really
easily right from the user interface
oh okay now we’re now we’re just gonna
have to roll through my hard drive and
find something
let’s get a nice wiring closet picture i
have no idea what this is
oh i know that that’s um from our recent
solar installation they messed up the
wiring side to send pictures to the
okay and then you can run it straight
from the preview show in preview window
which of course
you’re not going to see so i’m hoping
the folks are
on the ball with the sharing because
we’re going to need to switch quite a
bit here
let me see oh wonderful it’s untitled
window number two
not that one
okay i i i can’t get it doesn’t show the
sub window
properly okay so you’re gonna have to
trust me that there’s a preview window
which popped up
and in the preview window all these
controls are directly clickable because
it’s a javafx application and the javafx
is spawning another javafx application
which is actually your real view running
so let me let me open up another sample
of course is not going to show up
immediately just a sec
this one is probably called
sample okay so this is a more
complicated example
um which of course the last presentation
i used this for was
hyderabad so one of the great things
about um
doing virtual presentations is you can
you can travel the world and be
and this shows a more complicated
example where it has um drop shadow
on different things it has a nice image
in the background which is from a nasa
picture and shows you some more of the
capabilities of what you can actually do
with javafx components pretty easily
from within the editor
um so i think you you get the basic idea
from scene builder it allows you to do
lots of different advanced capabilities
in javafx to quickly mock up user
and then to take that directly into the
code which
you’re then going to create controllers
for and
build out your complicated business
logic which you need
okay not that screen
do that one
okay so now i’m going to get into some
different use cases for how you would
use javafx
um in industry and so some examples of
are one of them is this
training and resource management
application done by mint
and i think this actually is quite
typical of javafx user interfaces where
if you’re building a user interface for
internal uses and you need super
applications which have trees and tree
and grids and gantt charts
using a rich client framework like
javafx is is just natural it gives you a
lot more capabilities
lets you do things much more complicated
and also iterate much more quickly than
you can with web applications which
as you can imagine building this as a
web ui you basically kill yourself with
all the
the page load times and pagination and
scrolling and refreshes
even with modern javascript frameworks a
second application where
javafx just wins overall is anything
you’re doing um scientific applications
or you need to do 3d modeling
i’ll give some examples of 3d models in
a sec for practical examples of how you
actually build things in javafx but this
the nasa deep space trajectory explorer
diane who works for nasa was nice enough
to give us
some official screenshots for and
basically they have
scientific libraries in java and by
having a javafx user interface this
allows them to
directly take advantage of what they’re
inside the java code with a javafx 3d
accelerated representation
of celestial bodies and trajectories
which is what they’re doing for research
and i think something which all of us
have use for is mobile applications and
um with all the great work which gluon’s
been doing
with mobile applications um you can
actually build
entirely cross-platform mobile
that work on apple that work on android
and then also run on desktop and access
mobile specific apis like acceleration
and camera
and all these different apps and one
example of this is the devoxx conference
mobile application which
is entirely written in javafx and um you
you would never know this
from running it because it looks like
any other application in the store
but if you looked under the covers it’s
actually java code which is ahead of
time compiled for android and ios
applications and has really really good
performance um compared to even native
applications and a much better user
than you’d ever get from wrapping
javascript and browser
in in a mobile application
and a great practical example of this is
a game which
garrett wrote called space effects which
is now also published to
the respective mobile app stores and i’m
going to show you
running in the browser as an example of
um the power of javafx technology
and the way i’m going to show this
writing in the browser
is using a technology called jpro which
we’ll talk a little bit more about
when we get into how you do graphics
but basically what jpro does is it lets
you run javafx
in the browser and it it does all of the
all the rendering for the javafx
on the backend server it sends um
data to the front end javascript ui
which then does all the 2d
and scene graph rendering of what’s
coming from the back end and it gives
you this nice seamless
experience where you can see go ahead
and share the
screen i just shared where you can where
you can see
exactly what the back end javafx
is doing and as an end user it’s as
simple as clicking on a link
which runs the application so this is
the spacefx application running inside
the browser
and this is the same experience you get
on mobile
you get on desktop and you guys will all
be able to experience
just just how bad i am at um at actual
video games
uh if i could start it oh there we go
so you can see that for for an
application running on the um
in the browser this is really performant
and you can imagine if you actually um
running aside directly inside of a
mobile application
which has 3d acceleration or you had um
you weren’t trying to talk
and kill things at the same time this
would be a great experience
and you know either an awesome video
game or an awesome
even better business application
considering all the graphics
capabilities which javafx gives you
okay so now that you’ve you’ve seen a
little bit about the
um the capabilities of javafx let me get
into some specifics about
how you can do 3d graphics
inside of javafx and what i’ll do is
i’ll explain
the 3d graphics concepts and then we’ll
back into and we’ll show some
some code for how we can actually do
um so in javafx you start with some
basic primitives so you have boxes
cylinders and spheres
these are the the base primitives you
can use to
construct objects if you want to do more
complicated objects
where you want to do arbitrary shapes
and geometries you can import
models from a 3d program as a
triangle mesh and a mesh view so this
allows you to import
more complicated models but out of the
box you can use boxes cylinders and
spheres to construct
really quick 3d objects
and on top of this you texture map on
top of those either primitives or
imported graphics using
texture maps where you supply a uv map
which does the mapping from the texture
to the 3d model
um it takes the surface then it applies
it to the
the physical model which you have in the
scene graph
and you can define both the geometry and
how it gets
gets plotted and mapped for the in this
example we’re taking a
a flat mercator mapped um
picture of the world and then mapping it
to a
a sphere and um on top of that kind of
the third element you add in is 3d
lights 3d lights let you
um light up the scene by default there’s
kind of a general ambient light so you
can see objects if you don’t supply any
um but then you can supply your own
point lights and ambient lights and the
position of these the intensity of these
the color of these affect how things
will show up
in the scene graph and how they’ll be
displayed and in addition to this there
are some user-defined
open source libraries like fxyz which
allow you to programmatically create
more complex
shapes and i’ll show you an example of
this as well as a
an open source library that you can use
to to build more complicated
um user interfaces by using
um integration and dependencies and
other libraries so
just to to start out with this why don’t
take the um earth sphere example
um so go ahead and thank you and if
if you look at this this is a very
simple javafx application which
i have here um not much code and
this um creates a sphere
um so it’s building a sphere with a
radius of 400 taking the mercator image
and then applying it um
setting the um the material on it and
then gives us a little bit of control
so we can rotate the sphere via a
when we press the mouse and drag it and
then it adds a camera
and adds a point light to the scene so
i’m gonna i’m gonna go ahead and run
okay and give me a sec to share the
right window
okay so um what you’ll be able to see
here is the running
sphere and this is the the same flat
image i showed in the slides but now
it’s been it’s been projected
and texture mapped onto a sphere and
there’s some mouse handler so now when
you click and you drag you can
you can rotate the sphere and um
you know right right right around here
somewhere as um is denver so
um this this gives you a really
quick you know visually impressive user
interface with very
little code i mean it’s it’s under 100
lines and you can have a
a working 3d javafx application
okay so as a as a second example let’s
let’s look at some um
some lighting and how um
lighting affects um your application
so let me see which one do we want
well let’s hope this is the right one
okay so yeah this is the one i wanted so
this has um three different lights in it
we have a red light
a blue light um well two different
lights a red light a blue light but then
three different
coordinates x y and z for each of these
lights so
we can set the position of the two
lights we’re using binding here to set
the position of lights so these are all
declared as properties which is a
special extension in javafx and
properties unlike variables you can you
can bind to
using extra api on top of it which is in
a nice fluent interface and this allows
you to do things like
when the um when the slider moves
you also move the light so we’re going
to use some sliders to change the
position of the lights
and this is nice it avoids all the
typical event handler code which you’d
have to write in swing or earlier
and this is how we’re going to
illuminate the scene
which has a box and then these two
lights inside of it
okay so here you can see the um the
light example
and so the red light is is over here
i’ll pull
i’ll pull it to one side and the blue
is over here let’s pull it up up up up
okay so now you can see clearly the blue
and the red light are isolated
illuminating different sides of the
the sphere and the side which is black
has no illumination
now if we get the blue light to join the
red light
you can see that the combination of blue
and red light gives us a nice purple
um and um you know of course if we hide
the lights inside the sphere we’ll make
it entirely black
let’s turn it black okay so now we have
absolutely no lights because the two
lights are
are hidden um okay so that’s a good
can i use quantions
quaternions for rotations okay i don’t
know what a quaternion is
but that’s an excellent question so
maybe carl or jonathan knows the answer
to that
thanks thanks ed for asking good
questions and this is exactly what you
should do in the chat
while i’m talking feel free to chat
amongst yourselves or
ask questions to me and i’ll answer them
as they come along
okay so that’s a quick example of how
you can do point lights and
the last example i want to show which
which i think is a lot of fun
is um making use of
another one of the javafx apis
which is the ability to um
the ability to use a canvas for high
performance rendering
and in this example this is one of the
examples from the book
it it builds a a particle system
which you can control which is based on
the javafx canvas api um
and the way the javafx canvas api works
is traditional
javafx rendering is all
vector-based so you you add in you know
rectangles and other shapes and you
shade them and you set the line color
and all that stuff and you can draw
and you don’t have to worry about
refreshing each paint cycle
canvas is a much more low level api
where every paint cycle you you draw
exactly what you want
with the highest performance and um this
is kind of like the really really old
paint method in early java just
optimized for like modern web uis very
similar to canvas and web browsers and
you can do awesome high performance
like building particle systems which um
i’m going to show you
um an example of
okay so this one
particle particle what is this window
called particle system configurable
got it okay so this is an example of the
particle system in javafx um
and with a default configuration every
time you click
you get these little particles which
which get created
you can you can change the number of
particles so more
fewer particles the duration so we can
we can make them kind of get wider and
spread out a little more
the particle size um how
opaque they are the color of the
that that was not a good color choice
see this this is why um programmers
shouldn’t be designers i
there’s no way i’m going to get a good
color scheme if i don’t just use black
as the background
um but you can see that you can have you
can have a lot of fun with this
to build complex particle systems and
and absolutely kill your processor with
all the processing
um so again like this is another one of
the advanced features in javafx
is using the canvas you can do really
graphics which
basically give you absolute control over
what gets rendered in the
in the scene graph
okay so the next thing i’m going to go
into a little bit
is best practices for
when you’re building your javafx
application because i think
if you’ve if you’ve done any um ui
development in the past
probably there are certain things that
you you’ve traditionally done to build
ui applications and you know this is
2021 we have more modern
frameworks we have faster internet we
have larger drives
and the the way which you build
applications the considerations for
applications has changed
quite a bit as well okay so ed’s also
wonder if you can do euler angles that’s
that’s another good question and and
carl mentioned that the
check the fxyz apis to see if it
um quarterions or quaternions or other
things like that because they may
actually have support for some of this
um so when you’re packaging your
application the first thing to keep in
mind is that
um the the average size of applications
even on mobile
has greatly increased so back
you know seven eight years ago um
mobile app even on mobile devices you
your typical application was under
200 megabytes only about 100 megabytes
as of a few years ago it was quite
common for applications to be gigabytes
in size um so in comparison if you if
you look at the
the entire jdk if you bundled the entire
jdk with your application
that’s that’s like you know maybe like
100 megabytes or something so
the size of the jdk um doesn’t really
matter anymore
um at one time it was significant to try
to have
the java runtime separate from your
application but if you look at modern
applications and how they’re built
really nobody really nobody worries
about or has as a
primary concern the size of your of your
and so given this there’s there’s really
no good reason to
not bundle the jdk together with your
and there’s lots of good options for
doing this
so if you’re still handing out fat jars
where you package
all your dependencies and run the
command line you should you should stop
doing this
it’s not really a modern practice and
simply bundle your jdk using jlink or j
package j package is a new
um packager which originally was part of
javafx it was the
the j packager um when it was part of
javafx and they resurrected it for java
it’s the best way to package your javafx
applications on the command line
using core jdk tools um and
this is this is what you should be doing
if you’re shipping your applications to
end users so it’s a great experience for
them where they just rent it like a
native application
the other advantage of picking the java
version you package
is it doesn’t matter what jdk version
they have installed or don’t have
so it’s a jdk version you’ve tested
against when you release an update your
application you’re releasing with the
latest version of jdk and they’re
getting all the security fixes
would that come with it and it’s the jdk
version you’ve tested with so you know
it works
back in the day of of appleton webstart
you’ll be running against an arbitrary
jdk and often that would break your
application because the apis were in 100
compatible there’s a bunch of additional
options which which also
are great choices now i’ll talk a bit
about the next slide but using growl to
build native images
is a great way and actually the only way
to build on certain mobile applications
open web start is a great option if you
want to
deploy in the browser and
this is there’s an open source version
of webstart that’s supported by
caracone and you can go to openwebstart
to find out more about that
and i showed a demo of jpro earlier and
jpro is an awesome technology built by
one of our friendly javafx german
where you can run javafx straight in the
as long as you have a server side to do
the server side application rendering
the front end and the browser super
so um that’s great apologies for the
skype window open from my wife
and um let me talk a little bit about
how gluon works
so um gluon packages up your mobile
application together so you can take
your java application all of your
pick your version of the java and javafx
and it’ll package it all together inside
the the graw vm and the ahead of time
compiler aot support and graviem to
build in a single executable
they also have a bunch of mobile apis
which you can use to access the
the camera any of the on on-device
and it will spit out um builds which
will work on windows and linux and mac
um native images for desktop and native
images for mobile and embedded
and all their technology is open source
and free except for some of the um
special glue on controls which they let
you know that they’re they’re
specifically things which um
are proprietary but pretty much
everything which they contribute back to
the javafx core and the
the core classes are all open source and
available for free so
i think it’s a great way to get started
and gluon also provides all the official
javafx builds from javafx 11
and up so also go to their website and
get both javafx
and also the scene builder which we
talked about
the second best practice i’m going to
mention is really
you should target mobile first and i
think if you look at the adoption of
mobile in terms of traffic
the amount of mobile web traffic has
increased steadily
and now over half of the mobile half of
the traffic on the web comes directly
from mobile devices not even from
maybe that’s changed in the past year
because of
um since we’re all stuck at home i think
i at least
i’ve personally been on my desktop a lot
more than i have it on mobile devices
um but i think for the majority of the
world is still true that mobile devices
are the the primary view into the world
and the best way to develop on mobile is
gluons mobile support which works on
anything jdk 11
plus and up will run on mac os linux ios
and android has
great plugins for maven and gradle id
support for intellij eclipse and
and you can check out examples at the
url on screen
and the the third thing i think when
you’re looking at modern application
development is building for the cloud
so a great example of this is um eto
which is a an agile
planning framework which is built by a
company a german consultancy and
basically what they do is they allow you
synchronize scrum planning across
multiple different organizations and
have big live interactive whiteboards
or touch screens where you can work with
other folks
and any application like this you need a
back end you need a
cloud service backing it and again this
is this is what folks expect from modern
applications is that you just
you run it you get multi-tenant you get
online interaction and there’s no reason
why your your desktop applications
shouldn’t be just as interactive as your
web applications by using
it the advantage of things like rest
so i’m going to show you a quick example
of a javafx application with a rest api
which goes back and um checks the
checks the weather from a public um
service which which exposes what the
current weather is anywhere in the world
it’s using um a basic json parser
um and um um
json b interface in order to do the
marshalling and the unmarshaling
of the data and i i think when when
you’re looking at um
building java applications which have
cloud back-ends
there’s already a lot of great resources
on building applications using
spring framework using jsonb
using other other client server
technologies to
kind of give you the best of both worlds
and be able to
build applications which also have great
cloud backends so the javafx part of
this application is fairly simple
this is the entire code for the user
interface which is
under 100 lines it’s only 85 lines long
it adds in an image view for showing you
what the current weather conditions are
a label um some styling
and the the real work here is going back
and using this rest url to communicate
with the backend service which in this
case we’re going to
open weather map and of course we want
to check
the weather in denver and see how you
are all
doing out there in terms of weather and
then it it’s going to give it back in
let’s see what we did here celsius i
um so we convert from kelvin to celsius
using this formula we could also do our
own math formula if we wanted to do to
fahrenheit but
we all know what the superior scientific
measurement system is okay so i’m going
to go ahead and run this application
and then the weather app
okay so you should all soon be able to
see the the weather application the
current weather in denver is
clear 4.88
celsius which i i think is fairly cold
and 27
humidity so how does that feel to you
all um
in denver is that is that close to what
you’re feeling weather-wise
okay so so carl’s wonder if we do
you know we can we can always do
fahrenheit but
we have to actually have to do some
coding so let’s let’s do some
let’s do some group coding on this uh
what window is that
weather app one
okay so if i if i remember the formula
for this
we subtract and then we let’s see
celsius we we multiply
times five ninths or nine fifths nine
and we add 32 to it maybe
somebody somebody will correct me if
we’re wrong see
you’re kidding carl but this is it if we
didn’t actually um
make live changes to it then you
wouldn’t know that the code was actually
working it could all be
just kind of a fake a fake demo and
we’re not actually
um we’re not actually doing stuff
okay the weather app
okay so if i got thanks carl okay
so i believe the weather is 40 degrees
fahrenheit um which is
pretty cold almost freezing but not
but it’s a clear day out there so that’s
pretty good that’s pretty good weather
apparently 39 fahrenheit’s in in boulder
so we’re only
two degrees off about from from boulder
i chose i chose i chose denver now
okay so i think we’re i think we’re
doing pretty good on the rest api this
is calling back to open weather map
so it should be it should be pretty
now um the next thing we’re gonna do
because we’re having fun live coding is
i’m going to
i’m going to show you what a deployment
looks like
and we’re going to deploy the weather
app to
a back-end artifact management system so
of course
i’m choosing artifactory in advance i
configured my build script but if you’re
if you’re curious about what the build
script is looks like
it’s a gradle build script this is the
maven publish
and then here’s my credentials um
this instance is going to disappear in
two weeks but have added if you
if you want to play around with it okay
so this should have published to my
artifactory instance and then let me
let me quickly show you the the running
cloud instance i have
okay so we just we just did a deployment
to our cloud instance i’m refreshing the
so we can see the latest builds
um okay so we have a couple builds here
um i pushed one at
a couple right before the presentation
to make sure it work and they scanned
with no issues
and you can see the latest build here
which we built
so it shows you what module we published
i believe if we go in here we can see
exactly what dependencies we have
um so here are the artifacts
i think uh here we go dependencies
um so you can see we depend on jackson
which we’re using for the json be
parsing we’re depending on javafx base
javafx graphics and javafx controls
which are the three modules and we
should also be able to get some
some security data once once it finishes
and this is basically checking to make
sure that we don’t have any violations
against old versions of libraries which
might cause security issues
and it looks like we also have no no
security violations which is great
so our security checked out and scanned
successfully using x-ray which is our
security scanner
um okay so let me flip back over to the
let’s see
okay so um what i just showed you for
the uh obviously the code base is all
free and available as part of the book
we have a github repo with that
um the user interface i was using was
artifactory with our cloud subscription
again we have a free version of that as
well which is what i was using so if you
want to try that for artifact management
and security
um that’s the the main product which
jfrog does
um all of the stuff i’ve been showing
you is contributed by these
great folks so a couple of these folks
are are hanging out in the audience so
i’m going to give a shout out to um
jonathan giles who who did the um
apparently apparently i need some unit
tests too thanks jonathan
jonathan giles who who did the awesome
chapter on controls in the book
um carl’s also been an author and
contributor to a bunch of our javafx
books i can’t remember
were you a tech reviewer on this title
carl i can’t remember if we had you tech
review this or not
but also johan voss is an open jd
jose pereira gail
paul jim weaver
eugene sven um uh
tony william bruno oh bruno is also in
the audience
so thanks for coming out bruno bruno
borges uh waichi gao and of course
jonathan so
um all of us kind of came together and
we built what we think is the definitive
guide to modern
java clients with javafx and oh thanks
carl so carl was the tech reviewer on
so that’s awesome thank you and we got
permission from jpress to do a new
version of this so
um i haven’t actually told any of our
co-authors yet
so you guys are getting notified on the
jug stream but just like as of maybe
yesterday when when um they finally
finalized it with us we we have a new
version of this for javafx 17 which
we’re going to be working on
so um you can register for a chance to
a yoda lego set by entering the raffle
you can also sign up for a free cloud
trial as i mentioned
um which is the technology i’ve shown
the definitive guide to modern java
clients javafx is a great resource
so go out and buy a copy or as as i just
told you there’s a new version coming
out so so buy it buy a new copy
um once java 17 comes out so october you
should buy the new new edition
and this is also a great time for q a so
you want to
you want to hop down here matt and join
me and we can do a little bit of
chat in qa so uh
you got a comment from dean there cool
stuff um
what i liked about it is i’ve never seen
so many demos right usually there’s live
coding and then there’s one demo
but you had like four or five so that
was pretty awesome
yeah no i mean if you’re if you’re gonna
do ui technology it’s all about the
demos and how easy it is i mean nothing
i showed
would take more than you know maybe a
for most of us in the audience to to
um so it’s also really easy to get
started and build your own ui project
and just
just kind of hack around with them it’s
actually it’s actually we
the the example we used for the denver
was written in javafx as well we did a
little a little game written in javafx
to teach kids programming so it’s a
great way to
teach your kids as well yep and even my
kids taught that class so
if a couple of you know younger
teenagers can teach about javafx almost
anyone can
that was on raspberry pi that was really
neat so
absolutely i also found it funny that
you were using a weather app because
even though it says 40 right now we are
due for a mega storm of the century
coming in thursday night through sunday
they’re talking like three to five feet
and so
um i’m excited for that because of
skiing but i think anyone
probably isn’t but not many people are
flying these days so
yeah now the ski slopes must be must be
pretty good this year i mean
you’re not welcome to come and pack them
right now it’s uh it’s been not too bad
if you uh
if you get out and mask up you know nice
nice that’s really good
yeah so i don’t see any other
questions in the chat um congrats on the
new book that is awesome
that you are you know starting a new
version the fact that you think you’ll
have it done by october is also
i like that
yeah i mean it’ll kill us but somehow we
we always seem to make the deadline
and and get books published so um
i i think programmers are motivated by
yeah exactly um yeah and thanks thanks
um about javafx so i think
the reason why javafx has remained a
strong technology is because of the
um so folks like johann vos who are he’s
an open jdk
open jfx contributor he’s actually one
of the primary
folks working on javafx technology all
the folks at gluhan jose pareda
eugene the entire team there they’re
super passionate about javafx technology
and just folks in the community who have
stuck with it like um
you know bruno and dean and um
everyone else who who helped out with
the book um
i think they’re really passionate and
they they love the java community but
java effects as a technology
yeah it’s nice to have it as an option
that’s for sure
yep now this is awesome that i’m able to
present at the denver jug finally we’ve
been talking about this for a while but
it took it took it took you know fuji
and jfrog and everyone kind of pushing
me to do it to make it happen
well hopefully next time we can do it in
person and take you one of our
cool breweries around here yeah that’d
be awesome
all right well thank you for your time
we’ll let you go
and enjoy the rest of your evening all
right thanks very much matt
and thanks everyone for joining in the
audience and i hope you i hope you all
enjoyed and
you’re gonna pick javafx and do
something awesome with it for your next
technology so if you do
share on twitter mention me steve on
java and i’m happy to
promote and amplify folks who are doing
cool stuff
nice all right