JavaFX Fidelity

JavaFX gets to start on a clean slate, without burdens of compatibility with browsers. However, how well does it paint itself?

How are – say – Rectangles defined?

Is the startX based on center lines? or is it from the origin?

What about borders? Are borders painted to the bottom right of the origin?

How is the boundsInLocal defined?

Here is a piece of test code.

Rectangle
{
    strokeWidth:50 fill:null stroke:Color.BLACK
    x:0 y:0 width:200 height:200
}

and I didn’t like what I saw:

Rectangle with 50-pixel thick border

Overlaying a grid, we could see that the X and Y origins are indeed based on center lines.
rect2

The big disappointment comes from the boundsInLocal measurements:

Rectangle2D [
minX = -35.85533905029297,
minY=-35.85533905029297,
maxX=235.85535430908203,
maxY=235.85535430908203,
width=271.710693359375,
height=271.710693359375]

This doesn’t make any sense at all, and is going to make laying out components properly that much harder.


About this entry