Open Source JavaFX Now!

Steve On Java

Hacking Java, JavaFX, and Flash with Agility
  • rss
  • Home
  • About
  • Contact
    • E-mail Steve
    • SC2 Challenge
  • SvJugFX
  • JavaFX Petition
  • JFXtras
    • JFXtras Individual CLA
    • JFXtras Corporate CLA
  • Freedom From XML

JavaFX Store and JFrog Artifactory Videos on Ubivent

steveonjava | March 29, 2010

This past month we had a great combined meeting of the Silicon Valley JavaFX User Group (SvJugFx) together with the Silicon Valley Web User Group.  The presenters included Richard Hyde and James Allen from Oracle on the Java Store and Yoav Landman and Fred Simon from JFrog on repository management with Artifactory.

Our April SvJugFx presentation will feature Stuart Marks from the JavaFX Team in Hands on JavaFX – Scripting the Scene Graph.  To attend in person or via our live web stream (and be eligible for great prizes!), please sign-up here: http://www.svjugfx.org/calendar/12863551/

We were also fortunate enough to be contacted by the folks at Ubivent who have developed a JavaFX-based event platform.  Their platform is used by large corporations like SAP, and they have generously offered to host our videos going forward.  Therefore, you can now watch all the SvJugFx videos using JavaFX technology!

To watch the latest videos, you can go to the landing page for the new SvJugFX Video Site:

Registration is optional, but will allow you to comment on the presentations.  Once you launch the application you will be taken to an event hall that lets you choose which presentation you want to watch:

Finally, when you click on a presentation you will be given a virtual theater experience with side-by-side slides and video.  You can click on the double arrows to expand it to full screen, skip around by chapter, and comment on the video as you are watching.

For convenience, here are some links that will take you directly to the two videos and their associated slide shows:

Java Store & Java Warehouse Overview (video) (slides)

Repository Management with JFrog Artifactory (video) (slides)

Also, we have posted the videos on our Parleys SvJugFx Space and will continue to do that for folks who like using this excellent presentation platform.

 
Comments
2 Comments »
Categories
Events, JavaFX, SvJugFx, Video
Tags
artifactory, gradle, ivy, java store, SvJugFx
Comments rss Comments rss
Trackback Trackback

Live Video Streaming Guide – Part 2 : Hardware

steveonjava | March 6, 2010

This is the second installation of my Live Streaming Guide, which will go over all the hardware you need to get setup.  While you can spend tens of thousands of dollars on professional gear, it is possible to put together a high quality setup for a fraction of that cost.  You may also be able to reuse some of your existing hardware, further reducing the cost.

This setup is targeted at streaming a live presentation over the internet that includes a speaker and possibly some slides or a demo.  Not all of this hardware is required to get started, so I will present it in order of how critical it is to the quality of the presentation.

If you are just interested in knowing what I recommend and how much it will run you, skip to the Buying Guide.

Choosing a Camcorder

The first thing you will need is a camcorder to stream the video.  The reason to go with a camcorder rather than a webcam is that you will have more options for lenses and zooming, and will be able to get a much higher resolution (as high as 1920×1080 for HD).  HD camcorders are pretty common and fairly inexpensive; a good one can be bought new for around $600.  Also, chances are that you or someone you know already has one that you can take advantage of.

One important consideration for camcorders is the computer interface.  If the camcorder supports Firewire (IEEE 1394), you are in pretty good shape.  This means it will probably support DV or HDV streaming to a laptop that has Firewire, and video streaming software will automatically pick it up as an input device.  A popular model for doing video streaming is the Canon Vixia HV40 which can be purchased for around $650 new:

Canon Vixia HV40

Read the rest of this entry »

 
Comments
66 Comments »
Categories
Events, Video
Tags
Event, streaming, Video
Comments rss Comments rss
Trackback Trackback

Launching Hyperlinks from JavaFX (including Mobile)

steveonjava | March 4, 2010

Creating hyperlinks in JavaFX should be in the category of things that are trivially easy, but is complicated by various factors, such as deployment mode and Java version. First I will go into detail on all the different permutations of how you can launch links in a browser and under what circumstances each will work. Next I will give you a nice packaged solution that you can use as a library (if you are impatient, just skip to The Easy Way Out now).  Finally, I will show how you can do the same thing for JavaFX Mobile applications.

A Tale of 3 APIs

There are 3 different ways that you can launch hyperlinks in Java/JavaFX. It helps to have an internet connection such as broadband to be able to launch this. Unfortunately, none of them work in all circumstances, so you need to know when to call each. Here is a quick reference table:

AppletStageExtensionWeb Start BasicServiceDesktop.browse
Works in AppletYesYesYes
Works in Web StartNoYesYes
Works in ApplicationNoNoYes
Works on Java 1.5YesYesNo
Can Set TargetYesNoNo
Default Target_self_blank_self

AppletStageExtension

The first option is to use the JavaFX AppletStageExtension. This is only available if you are running as an Applet, but also gives you the most control over how the hyperlink is launched.  In addition to a URL you can also specify a target, which can be any of the standard HTML targets including the following (excerpted from the AppletStageExtension javadocs):

Target ArgumentDescription
"_self"Show in the window and frame that contain the applet.
"_parent"Show in the applet’s parent frame. If the applet’s frame has no parent frame, acts the same as “_self”.
"_top"Show in the top-level frame of the applet’s window. If the applet’s frame is the top-level frame, acts the same as “_self”.
"_blank"Show in a new, unnamed top-level window.
nameShow in the frame or window named name. If a target named name does not already exist, a new top-level window with the specified name is created, and the document is shown there.

Web Start BasicService

The second option is to use the Web Start BasicService.  This works from both JavaFX Applets and Web Start applications, but does not let you specify the HTML target.  It is effectively the same as using the AppletStageExtension with a target of “_blank”.

Here is a small code excerpt showing how you would call the Web Start BasicService from your JavaFX code:

def basicService = ServiceManager.lookup("javax.jnlp.BasicService") as BasicService;
basicService.showDocument(new URL(url));

Desktop.browse

The third option is to use the new Desktop class introduced in Java 1.6.  This works from Applet, Web Start applications, and Standard Execution (within a desktop Frame).  Unfortunately, it did not exist in Java 1.5, so it won’t work from JavaFX without a little hacking.

The quick and dirty hack is to modify your JavaFX distribution to include the rt.jar from Java 1.6 as explained in this earlier post.  The only problem with this is you also have to get all the other developers on your project to do the same (and redo this on every upgrade).

The friendlier approach is to use reflection to check and see if the Desktop class is available, and then invoke the methods dynamically.  There is quite a bit more boilerplate code, but it will allow you to compile with a plain vanilla JavaFX installation, and also handle the odd case where someone is trying to run JavaFX under 1.5.  (Which is unsupported on Windows/Unix, and is now even supported on 32-bit Mac systems with the release of Snow Leopard!).

Since the code is easier to follow without reflection, I will show that first:

Desktop.getDesktop().browse(new URI(url));

And here is the munged version with reflection:

try {
    def desktopClazz = Class.forName("java.awt.Desktop");
    def desktop = desktopClazz.getMethod("getDesktop").invoke(null);
    def browseMethod = desktopClazz.getMethod("browse", [URI.class] as java.lang.Class[]);
    browseMethod.invoke(desktop, new URI(url));
} catch (e) {
    println("Upgrade to Java 6 or later to launch hyperlinks: {url}");
}

The Easy Way Out

When things are easy to do, they will get done right.  To make sure that JavaFX applications do not fall prey to broken and inconsistent linking, I put together a library for JFXtras that takes care of all the plumbing for you.

There is a new JFXtras class called BrowserUtil that has a very simple API:

BrowserUtil.browse(url);

or

BrowserUtil.browse(url, target);

It is that simple…  Conversion of string URLs to URL or URI objects, selection of the correct API based on your deployment mode, and failover modes based on the Java version are all included.

In addition, I created an extended Hyperlink called the XHyperlink.  This behaves identically to the built-in control, with the addition of simple configuration of URL navigation (this is what hyperlinks are designed for, right?)  The usage of the XHyperlink class is as follows:

XHyperlink {
    text: "Oracle's Homepage", url: "http://oracle.com/"}
}

All of this functionality will be included in the JFXtras 0.6 release.  If you need it now, you can build off the head of our repo.  Otherwise we are working on a release, which I will announce on this blog shortly which you can follow.

What about JavaFX mobile?

None of these desktop techniques actually work on a mobile device, so this is not a 100% solution yet.

Fortunately, there is also a solution for JavaFX Mobile if you are willing to delve in to the Java ME APIs.  To do this you first need to get a handle to the MIDlet like this:

def midlet = com.sun.javafx.runtime.adapter.MIDletAdapter.getMidlet();

And then you can call platformRequest to launch a browser on the mobile device:

midlet.platformRequest(url);

Note: This requires use of private APIs, so this may not work in future JavaFX releases.

It is not possible to merge this in with the desktop solution, because the JavaFX Mobile libraries do not exist on the desktop platform (and vice versa), but it is relatively easy to use this technique yourself by copying and pasting the above code sample into a helper function in your application.

 
Comments
6 Comments »
Categories
JavaFX, JavaFX Mobile, JFXtras
Tags
hyperlinks, JavaFX, JavaFX Mobile, JFXtras
Comments rss Comments rss
Trackback Trackback

Publications

   

Upcoming Talks

JavaOne 2011

Android Open
Use code "WIDGETFX"
for 20% off!

JavaOne 2011

Steve On…

  • Everything
  • Agile
  • Flash
  • JavaFX

Archives

Affiliations

Awards

2009 JavaOne Rock Star!

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox