Links
Referers
Navigation
JavaFX: Texture Paint
08.01.2008 | 0 Comments
Now that the JavaFX technology preview has hit the streets I'm really starting to get excited about the capabilities of this technology. I'm building out some JavaFX bits and learning as I go and I'm very impressed with the robustness and stability of the preview. (Actually I've been pretty impressed for a while now - I've been playing with the daily openJFX compiler builds for a couple of months now). Kudos to all involved -- very impressive!
Anyway - now for some code
I wanted to be able to add a texture to a peice of geometry today and I realized that the java.awt.TexturePaint had not yet been included in the javax.scene.paint package. Well the good news is, it's very easy to integrate it (or any other paint's you might already have) into JavaFX. Here's how I did it:
package javadojo.fx.paint; | |
Hope someone finds this useful. Leave me a comment if you do 
JavaFX: Using both a Frame and an Application
07.29.2008 | 0 Comments
I'm building out our first JavaFX offering and ran into this so I'd thought I'd share my solution. I'm building an applet, and in Netbeans you have to right click on the .fx file that defines the applet to run it. Running the project does not launch the applet. While this is arguably a shortcoming in the Netbeans JavaFX plugin, it got me to thinking, what if you wanted to have both a frame and an applet.
To do this first create a Main.fx file which defines your frame. Main.fx is the default main class created when you create a new Netbeans JavaFX project. Your Main.fx Frame definition should look like this:
Frame {
| |
Notice that I have defined a custom node called AppGroup. I'll get to that in a bit...
Next I created a Applet.fx file which contains the Application definition:
Application {
| |
Notice that the the same AppGroup custom node is included as the content of the stage in the Application. All that's left is to create the custom node called AppGroup as follows:
public class AppGroup extends CustomNode {
| |
Now you can run the project which launches Main.fx and creates a Frame. Or you can select Applet.fx and choose run applet to run the applet.