The previous blog post provided an example, named EarthCubeFX, of creating a 3D application with JavaFX 1.3.
Today's post highlights Oracle JavaFX engineer and author Jim Clarke's experience running EarthCubeFX on JavaFX-TV. To quote Mr. Clarke:
The tag line is "JavaFX: Bringing Rich Experiences to All the Screens of Your Life", so I decided to put it to the test. Jim Weaver created a 3D demo called EarthCubeFX, and I wanted to know what needed to be done for it to run on a true JavaFX-TV platform. Luckily, I had just obtained an Intel Canmore CE3100 system that runs JavaFX-TV.
Obviously, the TV does not have a mouse, so the first thing I had to do is use some of the keys on the remote control to invoke the same behavior that the mouse buttons activated in Jim's original code. The JavaFX-TV runtime maps the remote control keys to JavaFX KeyEvent objects. The first choice was to decide which keys to use for the pitch and roll rotations; the remote's arrow keys were the obvious choice. I arbitrarily picked the CHANNEL_UP and CHANNEL_DOWN keys to do the Z translation, which moves the cube further back or forward in the field of view. Lastly, I used the OK key to take the cube back to its home position. I only added 8 lines of code, compiled the application in NetBeans using the JavaFX-TV Emulator, then copied the Jar file over to the Canmore and ran it as shown in the video. The Google map tile images are still fetched over the Internet. The animation, and 3D features, run exactly as on the desktop.
Here's a short video that Jim Clarke created of EarthCubeFX running in JavaFX-TV on the Canmore set-top box:
Also, here is the code that Jim Clarke added to handle remote controller keys:
public function keyRotation(ke: KeyEvent) : Void { if (ke.code == KeyCode.VK_RIGHT) { angleY++; } else if (ke.code == KeyCode.VK_LEFT) { angleY--; } else if (ke.code == KeyCode.VK_UP) { angleX--; } else if (ke.code == KeyCode.VK_DOWN) { angleX++ } else if (ke.code == KeyCode.VK_CHANNEL_UP) { translateZ -= 10; } else if (ke.code == KeyCode.VK_CHANNEL_DOWN) { translateZ += 10; } else if (ke.code == KeyCode.VK_ENTER) { goHomePosition(); } }
Thanks, Mr. Clarke! Also, remember that the deadline for RIA Exemplar Challenge entries is 22-May-2010 so please submit it if you haven't already!
Regards,
Jim Weaver
Hi, I like your post.
Some days ago, I tried to run some JavaFX applications using the TV emulator, provided by NetBeans. However, I have not had much success in this, as there appeared a series of errors like:
java.lang.reflect.InvocationTargetException
at com.sun.javafx.runtime.provider.GUIRuntimeProvider.getToolkit(GUIRuntimeProvider.java:59)
at com.sun.javafx.runtime.provider.GUIRuntimeProvider.run(GUIRuntimeProvider.java:66)
at com.sun.javafx.runtime.Entry.start(Entry.java:87)
at com.sun.javafx.runtime.Main.main(Main.java:80)
at sun.misc.CVM.runMain(CVM.java:554)
Caused by: java.lang.InternalError: Could not initialize prism toolkit, and the fallback is disabled.
at com.sun.prism.tk.PrismToolkitImpl.getToolkit(PrismToolkitImpl.java:405)
at com.sun.javafx.tk.prism.PrismToolkit.init(PrismToolkit.fx:65)
at com.sun.javafx.tk.Toolkit.getToolkit(Toolkit.fx:70)
... 5 more
I tried to prove JavaFX TV Emulator on different computers, but I keep getting the same error.
If you know how to fix this error or hardware required to run these applications, I would appreciate it.
Sincerely,
Thanks,
Posted by: Jadi | June 01, 2010 at 12:59 AM
Wow!! A tutorial on how to do that on T.V would be lovely :-D
Posted by: Jay | May 30, 2010 at 03:30 AM
Hi Jim,
Might I ask how you installed JavaFX-TV on your CE3100?
Any links on how to do it?
Posted by: Account Deleted | May 21, 2010 at 06:16 AM
Well Done. Can you talk more about the TV setup? What is the set top box that was used? It appears that Intel Canmore CE3100 is just a chip.
Posted by: vmatters | May 13, 2010 at 08:56 AM