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 are screenshots demonstating the FXContainer:
Here is the source code.
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 are screenshots demonstating the FXContainer:
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.


