private void resize() {
        width  = getWidth();
        height = getHeight();

        if (width > 0 && height > 0) {
            background.setCache(false);
            flap.setCache(false);

            background.setFitWidth(width);
            background.setFitHeight(height);

            flap.setFitWidth(width * 0.8461538462);
            flap.setFitHeight(height * 0.407960199);
            if (width < height) {
                flap.setTranslateX(width * 0.0769230769);
                flap.setTranslateY(width * 0.0769230769);
                rotateFlap.setPivotY(width * 0.715);
            } else {
                flap.setTranslateX(height * 0.0447761194);
                flap.setTranslateY(height * 0.0447761194);
                rotateFlap.setPivotY(height * 0.460199005);
            }

            background.setCache(true);
            flap.setCache(true);
            flap.setCacheHint(CacheHint.ROTATE);

            font = Font.font("Droid Sans Mono", background.getLayoutBounds().getHeight() * 0.7);

            upperBackgroundText.setWidth(flap.getLayoutBounds().getWidth());
            upperBackgroundText.setHeight(flap.getLayoutBounds().getHeight());
            upperBackgroundText.setTranslateX(flap.getTranslateX());
            upperBackgroundText.setTranslateY(flap.getTranslateY());

            lowerBackgroundText.setWidth(flap.getLayoutBounds().getWidth());
            lowerBackgroundText.setHeight(flap.getLayoutBounds().getHeight());
            lowerBackgroundText.setTranslateX(flap.getTranslateX());
            lowerBackgroundText.setTranslateY(0.4701492537 * background.getLayoutBounds().getHeight());

            flapTextFront.setWidth(flap.getLayoutBounds().getWidth());
            flapTextFront.setHeight(flap.getLayoutBounds().getHeight());
            flapTextFront.setTranslateX(flap.getTranslateX());
            flapTextFront.setTranslateY(flap.getTranslateY());

            flapTextBack.setWidth(flap.getLayoutBounds().getWidth());
            flapTextBack.setHeight(flap.getLayoutBounds().getHeight());
            flapTextBack.setTranslateX(flap.getTranslateX());
            flapTextBack.setTranslateY(flap.getTranslateY());

            ctxUpperBackgroundText.setFont(font);
            ctxLowerBackgroundText.setFont(font);
            ctxTextFront.setFont(font);
            ctxTextBack.setFont(font);

            refreshTextCtx();
        }
    }