2017
April
-
Getting JavaFX ListViews to Honor Container Width
I recently struggled trying to text in a JavaFX ListView to wrap inside the container like I asked it to, rather than extend (and disappear) past the boundaries of the container. After some discussion on Twitter and a bit of Googling, I found an answer that I thought I’d share here to, perhaps, save someone some time.
March
-
JavaFX Frameworks
In my work on my book, I’ve spent quite a bit of time with JavaFX. In the chapter I just submitted, I wrote the application using the NetBeans RCP, which I think is a great piece of software. My only "complaint", I think, is more of a philosophical one more than a technical one, and even stating it that way is probably really over-selling it: for the most part, to use the RCP is to use Swing. Sure, you can use JavaFX in the application, but it seems you have to hold your mouth just right to get two-way data flow working. Possible, but it seems like a bit of work.
At any rate, while casting around The Tubes to track down advice on how to solve one problem or another, I ran across a couple of more modern application frameworks that look really promising, Drombler FX and the Dolphin Platform. Both look pretty slick, but the former seems to be backed by "only one guy" and might be a bit slow moving, while Dolphin is backed by Canoo and, more specifically, Michael Heinrichs, Hendrik Ebbers, Dierk König.
Once I finish this book and have more time to play with shiny new things, I need to give both of these a spin.
I should probably note, though, that there’s nothing really wrong with the NetBeans RCP in any real technical sense (beyond the 'no software is perfect' notion). I just like shiny things. I did, though, successfully create my RCP app and found the experience to be quite nice. If you need a desktop application, you should definitely check out the RCP.
2014
June
-
Book Review: JavaFX 8: Introduction by Example
Carl Dea, this time with the help of Mark Heckler, Gerrit Grunwald, José Pereda, and Sean Phillips, recently published an updated and greatly expanded introductory work on JavaFX, with both the title and content updated to reflect the updates in the JDK and library.
tl;dr: A solid introduction with a plethora of usable examples. You can purchase it here.
-
LiveJournal Export
I have a personal LiveJournal blog that I’d like to migrate to Awestruct. Unfortunately, LiveJournal’s export tool is really limited, allowing the export of only one month at a time. There are tools to work around that, but the only ones I’ve seen require Windows, which rules me out. In typical geek fashion, then, I wrote my own tool, ljexport, a very quick-and-dirty JavaFX 8 application. All this does is export each month to its own file. Once you have the data, you’re on your own. :)
-
JavaFX and Maven
I’ve been tinkering with a couple of different JavaFX projects for a while now. Due to other commitments, they’ve been largely ignored recently, but I made some time this weekend to return to them. Since I last looked at them, Java 8, and, thus, JavaFX 8, have been release, so I decided to see how the tooling in NetBeans has changed to stay apace with the development of the libraries. While there are certainly updates, it seems new projects are still built using Ant. Yuck. :P I knew Adam Bien had a Maven archetype for his igniter.fx project, so I took a look to see what that POM does to support JavaFX. As it turns out, it’s pretty simple. For those interested, I have extracted here the basic POM:
2013
April
-
JavaFX and AsciiDoctor: a Quick and Dirty Hack
You may or may not have noticed ([1], [2]), but I’ve been spending a lot of time with AsciiDoc lately. While it might simply be a case of noticing what you’re thinking about, it seems the tool has been gaining more and more momentum. From AsciiDoctor to Awestruct, to Jason Porter’s Maven plugin, it seems to be everywhere. At any rate, in need of a break, I wondered if I could leverage AsciiDoctor’s Java integration library and JavaFX to make a simple editor. It’s basic and ugly, but here’s what I have.
-
DoctorFX
Earlier today, I wrote about a quick and dirty hack I put together to create a very simple editor for AsciiDoc files. While I have no immediate plans to make this a full-featured editor, there’s a part of me that can’t help but hack on it. This evening, I added support for loading and saving files. In fact, I’m using the editor to write this post. :)
For those interested in helping (or just need a good laugh :), you can find the code for this oh-so-cleverly-named project here.
2012
April
-
Java 7, NetBeans, Mac OS X, and a Little Bit of JavaFX 2
In a recent post showing how to use JavaFX 2 and NetBeans on the Mac, I noted that I have been unable to run NetBeans using Java 7 on my Mac for reasons I had not been able to figure out. Now, thanks to a pointer from Scott Kovatch, the technical lead at Oracle for the Mac OS X port of Java, I think I can show you how to do that.
-
Getting Started with JavaFX on the Mac
image::/images/2012/04/javafx_logo_color_1-300x150.jpg
As you may have guessed from my recent book review, I’ve been tinkering with JavaFX some, as time as permitted. I’ve been following the technology fairly closely since Sun announced the project way back in 2008. When it was announced that JavaFX 2.0 was finally available, albeit in preview form, for the Mac, I was ecstatic. I ran into issues, though, trying to get it to run in my IDE, though. After some guess work and googling, I finally figured it out. In retrospect, it may be obvious, but if you’re like me and are missing the obvious, I’m going to detail the steps I took to get it running on my Mac. Perhaps it can help someone out.more
The first step, of course, is to download the binaries. You can do that here, sort of. Since this is still a preview release at the time of this writing, you have click the teeny tiny link under the header. Once you’ve downloaded the distribution, you need to extract it somewhere:
1
$ unzip javafx_sdk-2_1_0-beta-b19-macosx-universal-27_mar_2012.zip -d $HOME/local/
You can, of course, put it anywhere you want, but you’ll need to adjust the following instructions. The next step is set up NetBeans. NetBeans has JavaFX support out of the box, assuming your JDK has JavaFX support. Since the Mac JDK does not yet, we need fix that. Otherwise, you’ll see this error:
To fix this, we need to create a Java Platform with JavaFX support (I don’t know why we can’t modify the default platform, but we can’t, so we get to create a new one, which we can set to be the default if we want). To do that, go to Tools > Java Platforms, where you should see something like this:
To create a new Java Platform, click the (wait for it…!) "Add Platform…" button in the lower left corner. OS X likes to put things in decidedly (to me) un-Unixy locations, and the JDK is no different. You can find the current JDK under
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
:We now need to give it a name, so we’ll call this "JDK 1.6 with JavaFX" and click OK. But wait, there’s no JavaFX support! To enable JavaFX support, we have to…um..enable it. Doing so looks like this:
We can now create a new JavaFX project:
Your new project is ready to run.
The even more adventurous may be wondering how one would do this with Java 7, to which I say, "Good question!" : ) I have mixed luck getting NetBeans and Java 7 to play nice on my Mac. It’s almost certainly pilot error, as I’ve done it before, as has Adam Bien, but I haven’t had a chance to debug things (e.g., the navigation tree under projects has all the tree icons, but no text. IIRC, the context menus are also text-less. Strange).
At any rate, as I noted earlier, in retrospect, this seems pretty easy (if a bit unintuitive) and might be documented somewhere, but I couldn’t find it. Either way, it’s certainly documented now. I hope it helps. : )
-
Book Review: Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology
image::http://www.apress.com/media/catalog/product/cache/9/image/9df78eab33525d08d6e5fb8d27136e95/A/9/A9781430268727-3d_11.png
I was privileged to be given a copy of the recently released Pro JavaFX 2: A Definitive Guide to Rich Clients with Java Technology from Apress, authored by James Weaver, Weiqi Gao, Stephen Chin, Dean Iverson, Johan Vos. This review is a bit overdue, but I hope you find it as helpful as I found the book.
2008
December
-
JavaFX 1.0 Release Set for December 4
With the release of JavaFX 1.0 scheduled for this Thursday, December 4, the JavaFX team set up a technical pre-launch call and invited JUG leaders, Java Champions, NetBeans Dream Team members and others to call in and get a sneak peak at what was coming (audio and slides available here). Josh Marinacci was the engineer on hand to give us the preview. A couple of things stood out to me that has me pretty excited.