Over a million developers have joined DZone.

JavaFX 1.0, Linux, NetBeans IDE

DZone's Guide to

JavaFX 1.0, Linux, NetBeans IDE

· Java Zone ·
Free Resource

"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.

Attracted by the Video Puzzle, I followed Weiqi Gao's brilliant instructions and now I have JavaFX 1.0 on Linux:

In particular, the list of samples is very promising:

They ran without a problem (except for the media player sample, which implies it is using native code, which is sad but unavoidable I assume). Here's one of the samples, illustrating drag and drop, in action:

I looked at the code for the samples and it looks pretty cool. Here's the whole media player:

package simplevideoplayer;

import javafx.stage.Stage;
import javafx.scene.Scene;
import com.sun.fxmediacomponent.*;
import javafx.scene.Group;

def mediaUrl:String ="http://capra.sfbay.sun.com/~jm158417/javafx_videos/big_buck_bunny_512x288_h264.flv";
println("using mediaUrl = {mediaUrl}");
var vidWidth = 512;
var vidHeight = 288;
var fullWidth = 700;
var fullHeight = 400;

var mediaBox:MediaComponent = MediaComponent {

// set the media and make the component visible
mediaSourceURL : bind mediaUrl

// the position and size of the media on screen
mediaX: (fullWidth-vidWidth)/2 // center
mediaY: (fullHeight-vidHeight)/2 // center
mediaViewWidth : vidWidth
mediaViewHeight: vidHeight
mediaVisible: true

// determines if the control bar is visible at all
controlBarVisible: true

// determines if the control bar is below the media or on top with a fade in
staticControlBar: false

// the position of the scroll bar.
//leave as the defaults to have it be below the media
//controlBarX: -1
//controlBarY: -1

// set the size for full screen.
// useful if you have extra component on the side which you turn off
// to cover with video in the full screen mode.
fullScreenWidth: fullWidth
fullScreenHeight: fullHeight
//fullScreen: true

// make the movie play as soon as it's loaded
mediaPlayerAutoPlay: true

// set the volume
volume: 0.5

Stage {
title: "Simple Media Player"
scene: Scene{
width: fullWidth
height: fullHeight
content: mediaBox

Then I wanted to work with all this myself, but as stated in many places, a Linux distro of the NetBeans support is still in the works. However, I found an old version for 6.1, which uses an out dated syntax, but played a bit with it just to get a feel for it:

Definitely looking forward to Linux & OpenSolaris support for JavaFX in NetBeans IDE! And, in the meantime, just open the samples in the Favorites window (yes, in NetBeans IDE 6.5) and then run them from the Ant script that accompanies each sample:

Now... read Weiqi Gao's introduction to JavaFX. Then you'll be ready when the Linux/OpenSolaris distros of the NetBeans tooling comes out.


"I love writing authentication and authorization code." ~ No Developer Ever. Try Okta Instead.


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}