Geertjan is a DZone Zone Leader and has posted 468 posts at DZone. You can read more from them at their website. View Full User Profile

JavaFX 1.0, Linux, NetBeans IDE

  • submit to reddit

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 ="";
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.


fig-1.png56.86 KB
fig-2.png97.81 KB
fig-3.png24.96 KB
fig-4.png21.08 KB
fig-5.png26.41 KB
fig-6.png96.19 KB
fig-7.png67.93 KB
Published at DZone with permission of its author, Geertjan Wielenga.


Christopher Daquigan replied on Wed, 2009/02/11 - 4:06am

do you have a media player using netbeans.. kindly give me the code and the interface? please i need it tnx alot...

Liu Huasong replied on Fri, 2009/02/13 - 9:33am

To let JavaFX 1.1 work on Linux and Netbeans, Please goto

You can even debug JavaFX in Linux.

Shoaib Abdullah replied on Mon, 2010/12/27 - 2:50am

Very good code. I will test it when I will get free time. modern interior designing earn money online

Abby Lays replied on Fri, 2011/04/08 - 8:15am

I've been using Eclipse since day 1 but most people don't enjoy using this software. Eclipse is an extensible development platform with runtimes and application frameworks for building, deploying and managing software across the entire software lifecycle. Many people know Eclipse as a Java IDE but I prefer to say Eclipse :) So what do you use ? Eclipse ? Netbeans ?

Abby - trading consultant and Java programmer.

Matt Coleman replied on Fri, 2013/01/18 - 1:39am in response to: Liu Huasong

Hi Lui,,thanks for reminding me i can debug JavaFx with Linux...i forgotten about it

buffalo freelance website designer 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.