|
|
|
|
What I don't like on JavaFX
Posted:
Jun 4, 2009 9:31 AM
|
|
|
A new version of JavaFX is out, and I want to say, what I don't like on JavaFX.
1. JavaFX 1.2 is binary incompatible to JavaFX 1.0 and 1.1
JavaFX 1.2 is completly different to the versions before. JavaFX can not run old JavaFX-compiled programs. In JavaFX 1.0 in all .class-files was a main-Method and Java starts the running Class-File direct. Now in JavaFX 1.2 in no generated .class-file is a main-Method. And Java starts at first its runtime as a Java-program and that starts then the JavaFX-program.
Nothing is wrong with binary-incompatiblity, if it would be in Beta-phase or so. But at the moment it changed after the 1.0 release. Will the binary format after every new JavaFX version change? Who creates then jfx-binary-programs, when they can not run on newer versions?
2. The JavaFX license
The license don't allow to copy JavaFX and its runtime or give it away. So, if you creates a JavaFX-program, the end-user have to download the JFX-runtime hinself. The EULA don't allow to give the runtime with iot away.
3. Is JavaFX OpenSource
The binary license have the mistake I have mentioned in (2.). But how open is JavaFX ? OpenJDK is under the GPL + GNU Classpath exception.
Ok, the Compiler IS OpenSource https://openjfx-compiler.dev.java.net/ And Scenegraph https://scenegraph.dev.java.net/ is as a library under the GPL without GNU Classpath exception! And the last version on that side is 0.6 from March 2008!
So, do you know, if the COMPLETE JavaFX is OpenSource or will be?
4. The syntax of JavaFX
I don't like the Syntax of JavaFX so much. I think it would be better, if JavaFX becomes a XML-precompiler or something like that.
For example, I have creates with ReportMill JFXBuilder a simple picture with a box, a star and so with color-gradients. If I save it, JFXBuilder creates a xml-file with the extension .rpt which looks this:
<?xml version="1.0" encoding="UTF-8"?> <document version="11" snap-margin="true" margin="36 36 36 36" null-string="<NA>"> <page width="600" height="400"> <oval x="146" y="65" width="227" height="88" causes-wrap-type="1"> <stroke /> <fill type="gradient" color="#ff6a98" color2="#001151" roll="-20" /> </oval> <rect x="109" y="113" width="120" height="87" opacity="0.8" causes-wrap-type="1"> <stroke /> <fill color="#02fd5e" /> </rect> <star x="155.383" y="83.383" width="195.233" height="195.233" roll="37.926" opacity="0.7" causes-wrap-type="1" startangle="0"> <stroke /> <fill type="gradient" color="#64fefe" color2="#fffa7f" roll="-36" /> </star> <line x="302" y="91" width="104" height="-26" causes-wrap-type="1"> <stroke /> </line> </page> </document>
And this is the generated JavaFX Code, which JFXBuilder creates from the same picture:
import javafx.scene.*; import javafx.scene.shape.*; import javafx.scene.paint.*; import com.jfxbuilder.fx.*;
// Scene Definition var scene = Scene { fill: Color.WHITE width: 600 height: 400 content: [ArcX { translateX: 146 translateY: 65 width: 227 height: 88 length: 360 stroke: Color.BLACK strokeWidth: 1 fill: LinearGradient { startX: -0.102 startY: 0.719 endX: 1.102 endY: 0.281 proportional: true stops: [Stop { offset: 0 color: Color {red: 1, green: 0.416, blue: 0.596} }, Stop { offset: 1 color: Color {red: 0, green: 0.067, blue: 0.318} }] } }, RectangleX { translateX: 109 translateY: 113 width: 120 height: 87 opacity: 0.8 stroke: Color.BLACK strokeWidth: 1 fill: Color {red: 0.008, green: 0.992, blue: 0.369} }, PathX { elements: [MoveTo {x: 195.233, y: 97.617}, LineTo {x: 127.782, y: 119.533}, LineTo {x: 127.782, y: 190.455}, LineTo {x: 86.094, y: 133.078}, LineTo {x: 18.643, y: 154.994}, LineTo {x: 60.33, y: 97.617}, LineTo {x: 18.643, y: 40.239}, LineTo {x: 86.094, y: 62.155}, LineTo {x: 127.782, y: 4.778}, LineTo {x: 127.782, y: 75.7}, ClosePath { }, MoveTo {x: 0, y: 0}, MoveTo {x: 195.233, y: 195.233}] translateX: 155.383 translateY: 83.383 width: 195.233 height: 195.233 rotate: 37.926 opacity: 0.7 stroke: Color.BLACK strokeWidth: 1 fill: LinearGradient { startX: -0.065 startY: 0.911 endX: 1.065 endY: 0.089 proportional: true stops: [Stop { offset: 0 color: Color {red: 0.392, green: 0.996, blue: 0.996} }, Stop { offset: 1 color: Color {red: 1, green: 0.98, blue: 0.498} }] } }, PathX { elements: [MoveTo {x: 0, y: 26}, LineTo {x: 104, y: 0}] translateX: 302 translateY: 65 width: 104 height: 26 stroke: Color.BLACK strokeWidth: 1 fill: null }] };
What is easyier to read? What code can you see on one monitor-side without scrolling?
Greatings theuserbl
|
|
|
|
|
|
|
Re: What I don't like on JavaFX
Posted:
Jun 8, 2009 5:04 PM
in response to: theuserbl
|
|
|
Wait a minute, is this even a fair comparison?
You have a "star" tag already defined in the XML file, while in the JFX code you are drawing the star manually. Of course the jfx code is going to be longer, you already defined the star elsewhere ... you could have done the same with the JFX code if you defined a "star" class.
Also in JFX you could specify the colors using the hex value too instead of the longer way you have used here.
|
|
|
|
|
|
|
|
Re: What I don't like on JavaFX
Posted:
Jun 9, 2009 12:42 AM
in response to: theuserbl
|
|
|
> For example, I have creates with ReportMill > JFXBuilder a simple picture with a box, a star and so > with color-gradients. > If I save it, JFXBuilder creates a xml-file with the > extension .rpt which looks this: > > > <?xml version="1.0" encoding="UTF-8"?> > <document version="11" snap-margin="true" margin="36 > 36 36 36" null-string="<NA>"> > <page width="600" height="400"> > <oval x="146" y="65" width="227" height="88" > causes-wrap-type="1"> > <stroke /> > <fill type="gradient" color="#ff6a98" > color2="#001151" roll="-20" /> > </oval> > <rect x="109" y="113" width="120" height="87" > opacity="0.8" causes-wrap-type="1"> > <stroke /> > <fill color="#02fd5e" /> > </rect> > <star x="155.383" y="83.383" width="195.233" > height="195.233" roll="37.926" opacity="0.7" > causes-wrap-type="1" startangle="0"> > <stroke /> > <fill type="gradient" color="#64fefe" > color2="#fffa7f" roll="-36" /> > </star> > <line x="302" y="91" width="104" height="-26" > causes-wrap-type="1"> > <stroke /> > /line> > </page> > document>
Is it possible to use functions, loops, define new classes for this xml file?
|
|
|
|
|