News »Browse Articles »
Jump into JavaFX, Part 4: The advanced APIs
0
Jump into JavaFX, Part 4: The advanced APIs
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
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
Search News
News Categories
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
-
How to stand out from other Java/JEE Professionals?
Published about 14-01-2009 | Rated +3 -
10 reasons IT certification will be important in 2009
Published about 05-01-2009 | Rated +2 -
The 9 hottest skills for `09
Published about 02-01-2009 | Rated +1 -
New Features in Servlets 3.0
Published about 05-01-2009 | Rated +4
Most Recent User Submitted News
- Terracotta acquires Ehcache
Published about 19-08-2009 | Rated 0 - Sun simplifies developing Java programs on mobile phones
Published about 04-06-2009 | Rated 0 - Inside the New Apache Solr
Published about 16-11-2009 | Rated 0 - Big (But Seemingly Small) Changes for java.net This Weekend
Published about 26-11-2009 | Rated 0







