JavaFX: Transparency and Linux
- April 27th, 2010
- Write comment
There have been a few posts regarding transparency under Linux. I have put that code together so that it can be used directly. This works for me:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | public def osName = FX.getProperty( "javafx.os.name" ); public def IS_LINUX = osName.contains( "inux" ); public def IS_MAC = osName.contains( "mac" ); public def IS_WINDOWS = osName.contains( "indows" ); public def IS_SOLARIS = osName.contains( "olaris" ); /** * Is the version of the running JDK at least major.minor.micro_update? * In 1.6.0_18 macro=1,minor=6,micro=0,update=18 */ public function jdkAtLeast( macro: Integer, minor: Integer, micro: Integer, update: Integer ): Boolean { def runtimeVersion = java.lang.System.getProperty( "java.runtime.version" ); def pattern = java.util.regex.Pattern.compile( "^(\\d)\\.(\\d)\\.(\\d)_(\\d+)-" ); def matcher = pattern.matcher( runtimeVersion ); if ( matcher.find() ) { def currentMacro = Integer.valueOf( matcher.group( 1 ) ); def currentMinor = Integer.valueOf( matcher.group( 2 ) ); def currentMicro = Integer.valueOf( matcher.group( 3 ) ); def currentUpdate = Integer.valueOf( matcher.group( 4 ) ); if ( currentMacro < macro or currentMinor < minor or currentMicro < micro or currentUpdate < update ) { return false; } } true } public function fixTransparency() { if ( IS_LINUX and jdkAtLeast( 1, 6, 0, 14 ) ) { java.lang.System.setProperty( "javafx.allowTransparentStage", "true" ); } } |
The skin returns a Rectangle {widht:70 height:150}. The layoutBounds are not affected in any way. But the boundsInLocal are bound to the bounds of the node.




