See which of your colleagues or former colleagues are already on Java Link: Check out the Contact Finder
News »Browse Articles » Jump into JavaFX, Part 4: The advanced APIs
0
Vote Vote

Jump into JavaFX, Part 4: The advanced APIs

Views 1 Views    Comments 0 Comments    Share Share    Posted 16-08-2009  
I introduced you to the basic JavaFX APIs: javafx.lang, javafx.util, and javafx.animation. I also discussed nodes, shapes, and images. In this article I`ll build on that discussion by introducing the JavaFX APIs for handling media, constructing GUIs (via Swing components, groups, layout managers, and custom nodes), and creating sophisticated graphic effects. I`ll conclude with a hands-on exercise in creating a stock ticker application and deploying it (via the Java Deployment Toolkit) as an applet to the Google Chrome browser.

Note that the discussion in this article is based on the JavaFX APIs in the JavaFX Preview SDK, which will differ somewhat from the APIs in JavaFX SDK 1.x. What you learn here will serve as background for my first look at JavaFX SDK 1.0 in the final two articles of this series.
Media

Rich internet applications need to support video and audio content, a fact that Sun is addressing via its Java Media Components (JMC) project. For starters, JMC consists of a media player API, which allows you to play video and audio in a variety of formats. Eventually, JMC will also offer APIs for capturing video and audio, and for providing other capabilities.

JavaFX exposes the media player API to scripts via the javafx.scene.media package`s five classes:

* Media represents a media resource, and contains information regarding the media`s source URI, resolution width and height, and more.
* MediaError describes the various errors that can occur while trying to play a media resource.
* MediaPlayer provides the means for playing and pausing media, responding to various media events, and more.
* MediaTimer specifies a time and an action to be performed when the playing media reaches this time.
* MediaView is a Node subclass that provides a transformable (depending on media support for transformations) view of playing media.

A simple player begins with a Media object whose source attribute is initialized to a target URI. This object is assigned to a MediaPlayer object`s media attribute, and the MediaPlayer object is assigned to a MediaView object`s mediaPlayer attribute. These relationships are illustrated in Listing 1`s BasicPlayer.fx source code.

Source:
http://www.javaworld.com/javaworld/jw-04-2009/jw-04-jump-into-jfx-4.html
0
Vote  Vote
Enter your comment:
No Comments For This News

Search News

What's the News?

Post a link to something interesting from another site, or submit your own original writing for the Java community to read.

Most Popular News

Most Recent User Submitted News