FXContainer v0.1

| 2 Comments | No TrackBacks
After playing around with the modification I made im my previous post to MediaView, I was able to come up with a solution that works for any Node you pass in. The class is called FXContainer. Its purpose it to scale its contents to whatever width & height you specify, while maintaining the aspect ratio of the original.

By default, this results in the "black bar" effect that you've probably seen used to maintain aspect ratio in movies. That is usually appropriate, but there are also times when you may want the content expanded to fit the FXContainer, while still respecting the aspect ratio. For example, you may want a background image to fill the entire frame, but not become distorted. That is what the fillDimensions attribute does.

Here is the source code.
You can run the demo via webstart below. I have pack200 enabled, which will greatly reduce the download size for those of you using the Java 1.6.10 beta.

No TrackBacks

TrackBack URL: http://www.coffeejolts.com/cgi-bin/mt4/mt-tb.cgi/99

2 Comments

This sounds like a good helper class.
I got the following error.
com.sun.deploy.net.JARSigningException: Could not verify signing in resource: http://www.coffeejolts.com/java/webstart/fxcontainer/lib/javafxc.jar

Btw, some jar files such as javafxc.jar, javafxdoc.jar are not necessary to run the FX app. Removing them would make prompt launching of your app.

Thanks for spotting that. I have fixed the pack200 issue and thinned out the jars used to only the necessary ones.

Leave a comment

About this Entry

This page contains a single entry by Coffeejolts published on August 8, 2008 2:04 PM.

An 'improved' JavaFX MediaView class was the previous entry in this blog.

Updated FXContainer is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 4.31-en