JavaFX canvas size in Pane
<p>I just started using JavaFX and I can't seem to solve this problem.
My canvases do not seem to fill the complete space available to them.
I set a size to my canvases, and they do have this size, but the pane around it becomes larger. This results in a white border on the right hand side and at the bottom of the Pane.</p>

<p>My code:</p>

<pre><code>@Override
public void start(Stage primaryStage) throws Exception {
    primaryStage.setTitle("ShellShock");
    primaryStage.setResizable(false);

    final Dimension SCREEN_SIZE = Toolkit.getDefaultToolkit().getScreenSize();

    Screen screen = new Screen(SCREEN_SIZE.getWidth() * 0.9, SCREEN_SIZE.getHeight() * 0.9);

    Scene scene = new Scene(screen);

    primaryStage.setScene(scene);
    primaryStage.show();
}
</code></pre>

<p>Screen class:</p>

<pre><code>public class Screen extends Pane {

private Canvas[] canvases;

public Screen(double width, double height) {
    this.setPrefSize(width, height);

    this.canvases = new Canvas[2];

    Canvas background = new Canvas(width, height);
    GraphicsContext gcb = background.getGraphicsContext2D();
    gcb.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.REFLECT, new Stop(0.4, Color.BLUE.darker()),
            new Stop(1.0, Color.BLUE.brighter().brighter())));
    gcb.fillRect(0, 0, width, height);
    Canvas foreground = new Canvas(width, height);

    this.canvases[0] = background;
    this.canvases[1] = foreground;

    this.getChildren().add(background);
    this.getChildren().add(foreground);
}
}
</code></pre>