|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 6 of 6
If files have been dragged, DragEvent's void acceptTransferModes(TransferMode... transferModes) method is called to tell the drag-and-drop runtime that the text area lets files be dropped onto it, and signifies to the
user that it's interpreting the drag as a copy operation.
Next, we create a DragEvent-parameterized EventHandler instance that responds to "drag dropped" drag events. It registers this instance with the TextArea by invoking void setOnDragDropped(EventHandler<? super DragEvent> value).
The event-handler first obtains the Dragboard instance and then verifies that the dragboard contains a list of files. If the text area's contents are dirty, the user is
prompted to save changes, after which changes are saved. After invoking DragBoard's List<File> getFiles() method to retrieve the list of files, the handler opens the first file and then invokes DragEvent's void setDropCompleted(boolean isTransferDone) method to indicate transfer success or failure.
Part 1's introduction presented the following two questions for you to ponder while reading this article:
For many applications, JavaFX 2 is already production-ready. However, this did not prove true for JPadFX, for the following reasons:
These examples demonstrate that JavaFX 2 still lacks important features, and is occasionally cumbersome to use. That said, in answer to the second question, yes: I believe that there are notable advantages to programming in JavaFX. Consider these advantages:
Just as I could have expanded the previous list, I could also add more items to this list. The point here is that JavaFX 2 does offer many compelling features that are worth investigating and using.
Is JavaFX 2 ready for production? Are you willing to live with the trade-offs in order to begin writing JavaFX applications now? Share your thoughts in the Comments section of this article.
I think that JavaFX 2's advantages outweigh its current limitations, and I encourage you to consider migrating some of your Swing UIs to JavaFX. Keep in mind that you may have to fall back on Swing for features that are currently not supported by JavaFX 2. However, the need to do so will diminish as JavaFX's feature set expands. Although JavaFX 2's threading model results in more cumbersome code to properly deal with modal stage-based dialog boxes, perhaps this limitation will also be addressed in a future JavaFX release.
Jeff Friesen is a freelance tutor and software developer with an emphasis on Java and Android. In addition to writing Java and Android books for Apress, Jeff has written numerous articles on Java and other technologies for JavaWorld, informIT, Java.net, and DevSource. Jeff can be contacted via his website at TutorTutor.ca.
Read more about Enterprise Java in JavaWorld's Enterprise Java section.
More from JavaWorld