private void zoom() {
        if (grammarWindow == null) {
            return;
        }

        double zoomFactor = grammarWindow.getZoomLevel();
        int realWidth = getWidth();
        int realHeiht = getHeight();

        g2.translate(realWidth / 2, realHeiht / 2);
        g2.scale(zoomFactor, zoomFactor);
        g2.translate(-realWidth / 2, -realHeiht / 2);
    }