JavaFX Dialogs, Anyone?

A common question about JavaFX, especially for those coming from a Swing background, is "How do I do Dialogs?"

The reason this is a question at all is that, currently, there is no baked-in capability to do dialog boxes within a pure JavaFX 2.x application. But come on...you wouldn't be reading about this at all if you weren't a resourceful programmer. You have ways of making things happen.  :-)

I ran across a decent patch of code recently that handles many of the dialog chores for you. Pros and cons follow, but pointing your browser to this link on Github (appropriately named JavaFXDialog) will get you off to a good start.

Here are some screen shots the original code author, Anton Smirnov, provided:


Nothing fancy, just clean and functional. Now, about those pros and cons. From my perspective, here's the bottom line:

Pros

  • Already developed. Time required to implement is limited to downloading and decompressing the file, doing a bit of reading, and writing a few lines of code to try things out.
  • Easy. Most of the work is done, and the interface is pretty simple.
  • Open source. If you want to make changes - and I'm already thinking along those lines, so you may as well admit you will, too - you can do it.

Cons

  • Documentation. What you see on the Wiki page is the extent of it.
  • Lack of activity. As of the date this article was published, the code hasn't been updated in several months...so the project is a bit stale.
To be fair, the cons listed above won't cause anyone to lose sleep. After all, you don't expect constant revisions against something that works well enough for most purposes, and if your needs exceed what is there, it's easy to mod the code yourself or "roll your own" if you prefer. The lack of documentation isn't a show-stopper either due to the limited functionality and complexity of the code.

Wrapping It Up

If you need a quick, drop-in dialog capability for your JavaFX 2.x app, give it a try and see what you think. And if you're already using something you like, please share it as well! I'd love to hear from you, take a look at what you pass along, and maybe do a "dialog shoot-out" article in the future. So..what works for you?  :-)


All the best,
Mark
Comments:

I tried this out - a boon. Unfortunately, the icons don't display at all. Tried opening in a graphics editor, they seem corrupted.

Posted by Anil on March 27, 2013 at 01:56 AM PDT #

Hi Anil,

Thanks for the compliment. I used the same icon files for DialogFX and MonologFX; would you try to re-download them from my GitHub page(s)? Perhaps they were corrupted somehow in the earlier download, especially if a graphics editor also can't read them...

If that doesn't work, I can email you a .zip file of the icons. Just let me know.

All the best,
Mark

Posted by Mark Heckler on March 27, 2013 at 02:56 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Java Jungle addresses all things Java (of course!) and any other useful and interesting tools & platforms that help us GET IT DONE. "Artists ship," after all. :)

Your Java Jungle guide is Mark Heckler, a Software Architect/ Engineer and Oracle Developer Evangelist with development experience in numerous environments. Mark's current pursuits and passions all revolve around Java, the Cloud, & the IoT, and leave little time to blog or tweet - but somehow, he finds time to do both anyway.

Mark lives with his very understanding wife in the St. Louis, MO area.



Stay Connected

Search

Archives
« August 2015
SunMonTueWedThuFriSat
      
1
3
4
5
6
7
8
10
11
12
13
14
15
16
18
19
20
21
22
23
25
26
27
28
29
30
31
     
Today