private void zoomOutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_zoomOutButtonActionPerformed
        diagramPanel.getScaleRatio()[0] -= 0.25;
        diagramPanel.getScaleRatio()[1] -= 0.25;
        diagramPanel.getScaleRatio()[0] = Math.max(0.3, getDiagramPanel().getScaleRatio()[0]);
        diagramPanel.getScaleRatio()[1] = Math.max(0.3, getDiagramPanel().getScaleRatio()[1]);
        int minX = Integer.MAX_VALUE;
        int minY = Integer.MAX_VALUE;
        int maxX = 0;
        int maxY = 0;
        Element e = null;
        Element e2 = null;
        ArrayList<Element> elements = new ArrayList<Element>();
        if (this.graph instanceof PetriNet) {
            PetriNet pn = (PetriNet) this.graph;
            elements = new ArrayList<Element>();
            elements.addAll(pn.getListOfArcs());
            elements.addAll(pn.getListOfPlaces());
            elements.addAll(pn.getListOfResources());
            elements.addAll(pn.getListOfTransitions());
        }
        if (this.graph instanceof PrecedenceGraph) {
            PrecedenceGraph pg = (PrecedenceGraph) this.graph;
            elements = new ArrayList<Element>();
            elements.addAll(pg.getListOfArcs());
            elements.addAll(pg.getListOfNodes());
        }
        for (Element element : elements) {
            if (minX > element.getX()) {
                minX = element.getX();
                e = element;
            }
            if (minY > element.getY()) {
                minY = element.getY();
                e2 = element;
            }
            if (maxX < element.getX()) {
                maxX = element.getX();
            }
            if (maxY < element.getY()) {
                maxY = element.getY();
            }
        }
        int graphWidth = maxX - minX;
        int graphHeight = maxY - minY;
        int w = (int) (((this.diagramScrollPane.getWidth()/2)-(graphWidth/2))/this.getDiagramPanel().getScaleRatio()[0]);
        int h = (int) (((this.diagramScrollPane.getHeight()/2)-(graphHeight/2))/this.getDiagramPanel().getScaleRatio()[1]);
        int newX = (int) ((minX-w-50/this.getDiagramPanel().getScaleRatio()[0])*this.getDiagramPanel().getScaleRatio()[0]);
        int newY = (int) ((minY-h-50/this.getDiagramPanel().getScaleRatio()[0])*this.getDiagramPanel().getScaleRatio()[1]);
        this.diagramScrollPane.getViewport().setViewPosition(new java.awt.Point(newX,newY));
        repaint();
    }