/**
 * 
         -------- Copyright (C) [2012]  [Kristofer SCHWEIGER & Niklas FLORIAN1]---------

    This program is free software; you can redistribute it and/or modify it under the terms of the
 *  GNU General Public License as published by the Free Software Foundation; either version 2 of the License,
 *  or (at your option) any later version.
    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *  See the GNU General Public License for more details.
 * 
    You should have received a copy of the GNU General Public License along with this program; if not, 
 *  write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA

 * 
 * For any licensing issues please contact us under following adress: Mosaik.Projekt.2012@gmail.com
 */
package gui;

import dataBase.DataBase;
import dataBase.TimedAction;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.filechooser.FileFilter;
import mosaik.MosaikFunctions;
import org.jdesktop.application.Action;
import util.simpleIO.Out;

public class MosaikApp extends javax.swing.JFrame {

   
    public MosaikApp() {
        System.out.print(getClass().getResource("/gui/resources/Masiak_logo.png"));
         Image icon = Toolkit.getDefaultToolkit().getImage(getClass().getResource("/gui/resources/Masiak_logo.png"));
         setIconImage(icon);
        initComponents();
        disableAllComponents(false);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPaneMain = new javax.swing.JScrollPane();
        jPanelMain = new javax.swing.JPanel();
        jPanelRightMenue = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jLabel14 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jTextField2 = new javax.swing.JTextField();
        jPanel3 = new javax.swing.JPanel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jTextField3 = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel7 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jLabel15 = new javax.swing.JLabel();
        jTextField4 = new javax.swing.JTextField();
        jTextField5 = new javax.swing.JTextField();
        jPanel7 = new javax.swing.JPanel();
        jLabel21 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        jProgressBar1 = new javax.swing.JProgressBar();
        jTabbedPane = new javax.swing.JTabbedPane();
        jScrollPaneForLoadedPic = new javax.swing.JScrollPane();
        jLabelForOriginalPic = new javax.swing.JLabel();
        jScrollPaneForGeneratedPic = new javax.swing.JScrollPane();
        jLabelForMosaik = new javax.swing.JLabel();
        jScrollPaneForCompareMosaikAndLoadedPic = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        jLabelOfRisizedComparePic = new javax.swing.JLabel();
        jPanel6 = new javax.swing.JPanel();
        jLabeljLabelOfRisizedCompareMosaik = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        fileMenu = new javax.swing.JMenu();
        openMenuItem = new javax.swing.JMenuItem();
        saveMenuItem = new javax.swing.JMenuItem();
        saveCurrentDatabaseMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        editMenu = new javax.swing.JMenu();
        jMenuItemConfiguration = new javax.swing.JMenuItem();
        helpMenu = new javax.swing.JMenu();
        aboutMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Mosaik Pro");
        setIconImages(null);
        getContentPane().setLayout(new java.awt.GridLayout(1, 0));

        jScrollPaneMain.setName("jScrollPaneMain"); // NOI18N

        jPanelMain.setName("jPanelMain"); // NOI18N
        jPanelMain.setPreferredSize(new java.awt.Dimension(1000, 768));

        jPanelRightMenue.setName("jPanelRightMenue"); // NOI18N
        jPanelRightMenue.setPreferredSize(new java.awt.Dimension(303, 1040));

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel2.setName("jPanel2"); // NOI18N

        jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel14.setText("3. Schritt:");
        jLabel14.setName("jLabel14"); // NOI18N

        jLabel13.setText("Anzahl der Mosaikteile für die");
        jLabel13.setName("jLabel13"); // NOI18N

        jLabel17.setText("Spalten (X):");
        jLabel17.setName("jLabel17"); // NOI18N

        jLabel18.setText("Reihen (Y):");
        jLabel18.setName("jLabel18"); // NOI18N

        jTextField1.setText("50");
        jTextField1.setName("jTextField1"); // NOI18N

        jTextField2.setText("50");
        jTextField2.setName("jTextField2"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13)
                    .addComponent(jLabel14)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel18)
                            .addComponent(jLabel17))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.LEADING))))
                .addContainerGap(122, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel14)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel13)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel17)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel3.setName("jPanel3"); // NOI18N

        jLabel19.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel19.setText("4. Schritt (optional)");
        jLabel19.setName("jLabel19"); // NOI18N

        jLabel20.setText("Prozent:");
        jLabel20.setName("jLabel20"); // NOI18N

        jTextField3.setText("100");
        jTextField3.setToolTipText("Hier können Sie die Auflösung des fertigen Mosaik beeinflussen.\nzB.: 100 % = Bildauflösung des Originalbildes wird verwendet\n       200 % = Bildauflösung wird verdoppelt"); // NOI18N
        jTextField3.setName("jTextField3"); // NOI18N

        jLabel22.setText("Bildauflösung");
        jLabel22.setName("jLabel22"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel19)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel20)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel22))
                .addContainerGap(139, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel19)
                .addGap(9, 9, 9)
                .addComponent(jLabel22)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel20)
                    .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel4.setName("jPanel4"); // NOI18N

        jLabel2.setText("Bitte wählen Sie das Bild aus, das als");
        jLabel2.setIconTextGap(1);
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel1.setText("1. Schritt:");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel3.setText("Ausgangsmaterial für das Mosaik dient.");
        jLabel3.setIconTextGap(1);
        jLabel3.setName("jLabel3"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance().getContext().getActionMap(MosaikApp.class, this);
        jButton1.setAction(actionMap.get("openPictureDialog")); // NOI18N
        jButton1.setName("jButton1"); // NOI18N

        jLabel8.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel8.setText("2. Schritt:");
        jLabel8.setName("jLabel8"); // NOI18N

        jLabel7.setText("Bestehende Datenbank wählen");
        jLabel7.setName("jLabel7"); // NOI18N

        jButton2.setAction(actionMap.get("chooseDatabase")); // NOI18N
        jButton2.setName("jButton2"); // NOI18N

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel5.setText("oder:");
        jLabel5.setName("jLabel5"); // NOI18N

        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel12.setText("Sofern Sie noch keine Datenbank haben,");
        jLabel12.setAlignmentY(0.0F);
        jLabel12.setName("jLabel12"); // NOI18N

        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel11.setText("können Sie hier eine neue Datenbank aus");
        jLabel11.setAlignmentY(0.0F);
        jLabel11.setName("jLabel11"); // NOI18N

        jButton3.setAction(actionMap.get("chooseDirectoryOfPictures")); // NOI18N
        jButton3.setName("jButton3"); // NOI18N

        jButton6.setAction(actionMap.get("creatNewDatabase_BasedOnDirectory")); // NOI18N
        jButton6.setName("jButton6"); // NOI18N

        jLabel15.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabel15.setText("einem beliebiges Verzeichnis erstellen lassen.");
        jLabel15.setAlignmentY(0.0F);
        jLabel15.setName("jLabel15"); // NOI18N

        jTextField4.setEditable(false);
        jTextField4.setName("jTextField4"); // NOI18N

        jTextField5.setEditable(false);
        jTextField5.setName("jTextField5"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3)
                    .addComponent(jLabel2)
                    .addComponent(jButton1)
                    .addComponent(jLabel8)
                    .addComponent(jLabel7)
                    .addComponent(jButton2)
                    .addComponent(jLabel5)
                    .addComponent(jLabel12)
                    .addComponent(jLabel11)
                    .addComponent(jLabel15)
                    .addComponent(jButton3)
                    .addComponent(jButton6)
                    .addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 243, Short.MAX_VALUE)
                    .addComponent(jTextField4))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addGap(1, 1, 1)
                .addComponent(jLabel3)
                .addGap(8, 8, 8)
                .addComponent(jButton1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel8)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel5)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel12)
                .addGap(1, 1, 1)
                .addComponent(jLabel11)
                .addGap(1, 1, 1)
                .addComponent(jLabel15)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(7, 7, 7))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel7.setName("jPanel7"); // NOI18N

        jLabel21.setFont(new java.awt.Font("Tahoma", 1, 12));
        jLabel21.setText("5. Schritt");
        jLabel21.setName("jLabel21"); // NOI18N

        jButton4.setAction(actionMap.get("createMosaik")); // NOI18N
        jButton4.setName("jButton4"); // NOI18N

        jButton5.setAction(actionMap.get("exportMosaik")); // NOI18N
        jButton5.setName("jButton5"); // NOI18N

        jProgressBar1.setName("jProgressBar1"); // NOI18N
        jProgressBar1.setStringPainted(true);

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel21)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel7Layout.createSequentialGroup()
                                .addComponent(jButton4, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel7Layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(jButton5)))
                .addContainerGap())
        );

        jPanel7Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton4, jButton5});

        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel21)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton4)
                    .addComponent(jProgressBar1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(25, 25, 25)
                .addComponent(jButton5)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel7Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jButton4, jProgressBar1});

        javax.swing.GroupLayout jPanelRightMenueLayout = new javax.swing.GroupLayout(jPanelRightMenue);
        jPanelRightMenue.setLayout(jPanelRightMenueLayout);
        jPanelRightMenueLayout.setHorizontalGroup(
            jPanelRightMenueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRightMenueLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelRightMenueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanelRightMenueLayout.setVerticalGroup(
            jPanelRightMenueLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelRightMenueLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18))
        );

        jTabbedPane.setName("jTabbedPane"); // NOI18N

        jScrollPaneForLoadedPic.setName("jScrollPaneForLoadedPic"); // NOI18N

        jLabelForOriginalPic.setName("jLabelForOriginalPic"); // NOI18N
        jScrollPaneForLoadedPic.setViewportView(jLabelForOriginalPic);

        jTabbedPane.addTab("Originalbild", jScrollPaneForLoadedPic);

        jScrollPaneForGeneratedPic.setName("jScrollPaneForGeneratedPic"); // NOI18N

        jLabelForMosaik.setName("jLabelForMosaik"); // NOI18N
        jScrollPaneForGeneratedPic.setViewportView(jLabelForMosaik);

        jTabbedPane.addTab("Mosaik", jScrollPaneForGeneratedPic);

        jScrollPaneForCompareMosaikAndLoadedPic.setName("jScrollPaneForCompareMosaikAndLoadedPic"); // NOI18N

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setPreferredSize(new java.awt.Dimension(885, 704));

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Original"));
        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setPreferredSize(new java.awt.Dimension(426, 386));
        jPanel5.setLayout(new java.awt.GridLayout(1, 0));

        jLabelOfRisizedComparePic.setAlignmentY(0.0F);
        jLabelOfRisizedComparePic.setIconTextGap(0);
        jLabelOfRisizedComparePic.setName("jLabelOfRisizedComparePic"); // NOI18N
        jPanel5.add(jLabelOfRisizedComparePic);

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Mosaik"));
        jPanel6.setName("jPanel6"); // NOI18N
        jPanel6.setLayout(new java.awt.GridLayout(1, 0));

        jLabeljLabelOfRisizedCompareMosaik.setAlignmentY(0.0F);
        jLabeljLabelOfRisizedCompareMosaik.setName("jLabeljLabelOfRisizedCompareMosaik"); // NOI18N
        jPanel6.add(jLabeljLabelOfRisizedCompareMosaik);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(40, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jPanel5, jPanel6});

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(330, Short.MAX_VALUE))
        );

        jPanel1Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jPanel5, jPanel6});

        jScrollPaneForCompareMosaikAndLoadedPic.setViewportView(jPanel1);

        jTabbedPane.addTab("Vergleich", jScrollPaneForCompareMosaikAndLoadedPic);

        javax.swing.GroupLayout jPanelMainLayout = new javax.swing.GroupLayout(jPanelMain);
        jPanelMain.setLayout(jPanelMainLayout);
        jPanelMainLayout.setHorizontalGroup(
            jPanelMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelMainLayout.createSequentialGroup()
                .addComponent(jPanelRightMenue, javax.swing.GroupLayout.PREFERRED_SIZE, 296, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 919, Short.MAX_VALUE))
        );
        jPanelMainLayout.setVerticalGroup(
            jPanelMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelMainLayout.createSequentialGroup()
                .addGroup(jPanelMainLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanelRightMenue, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 757, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 757, Short.MAX_VALUE))
                .addContainerGap())
        );

        jScrollPaneMain.setViewportView(jPanelMain);

        getContentPane().add(jScrollPaneMain);

        fileMenu.setMnemonic('f');
        fileMenu.setText("Datei");

        openMenuItem.setAction(actionMap.get("openPictureDialog")); // NOI18N
        fileMenu.add(openMenuItem);

        saveMenuItem.setAction(actionMap.get("exportMosaik")); // NOI18N
        fileMenu.add(saveMenuItem);

        saveCurrentDatabaseMenuItem.setAction(actionMap.get("saveCurrentDatabase")); // NOI18N
        fileMenu.add(saveCurrentDatabaseMenuItem);

        exitMenuItem.setAction(actionMap.get("exit")); // NOI18N
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        editMenu.setMnemonic('e');
        editMenu.setText("Einstellungen");

        jMenuItemConfiguration.setAction(actionMap.get("configuration")); // NOI18N
        jMenuItemConfiguration.setName("jMenuItemConfiguration"); // NOI18N
        editMenu.add(jMenuItemConfiguration);

        menuBar.add(editMenu);

        helpMenu.setMnemonic('h');
        helpMenu.setText("Hilfe");

        aboutMenuItem.setAction(actionMap.get("showAbout")); // NOI18N
        aboutMenuItem.setMnemonic('a');
        aboutMenuItem.setText("Über");
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        setJMenuBar(menuBar);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void exitMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitMenuItemActionPerformed
        System.exit(0);
    }//GEN-LAST:event_exitMenuItemActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */

        try {
            javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());
        } catch (Exception e) {
            e.printStackTrace();
        }

        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MosaikApp().setVisible(true);
            }
        });
    }

    //   --------------------------------------------------------------------------
    public static void resetProgressbar() {
        if (jProgressBar1 != null) {
            jProgressBar1.setValue(0);
            progress = 1;
            jProgressBar1.validate();
            jProgressBar1.repaint();
        }
    }

    @Action
    public static void setProgressvalue() {

        if (jProgressBar1 != null) {

            jProgressBar1.setValue(progress);
            jProgressBar1.validate();
            jProgressBar1.repaint();
            progress++;
        }
    }

    public void disableAllComponents(boolean b) {

        jButton2.setEnabled(b);
        jButton3.setEnabled(b);
        jButton4.setEnabled(b);
        jButton5.setEnabled(b);
        jButton6.setEnabled(b);
        jTextField1.setEnabled(b);
        jTextField2.setEnabled(b);
        jTextField3.setEnabled(b);
        jTabbedPane.setEnabled(b);
        jProgressBar1.setEnabled(b);
        saveMenuItem.setEnabled(b);
        saveCurrentDatabaseMenuItem.setEnabled(b);


    }

    public void enableComponents1(boolean b) {

        jButton3.setEnabled(b);
        jButton2.setEnabled(b);
        jButton6.setEnabled(b);
        jTabbedPane.setEnabled(b);

    }

    public void enableComponents2(boolean b) {


        jTextField1.setEnabled(b);
        jTextField2.setEnabled(b);
        jTextField3.setEnabled(b);
        jButton4.setEnabled(b);
        jProgressBar1.setEnabled(b);
        jTabbedPane.setEnabled(b);
        saveCurrentDatabaseMenuItem.setEnabled(b);
    }

    @Action
    public void openPictureDialog() {

        choosePicDialog = new ChoosePicture(this, true);
        choosePicDialog.setLocationRelativeTo(this);
        choosePicDialog.pack();
        choosePicDialog.setVisible(true);

    }

    @Action
    public void chooseDirectoryOfPictures() throws IOException {

        JFileChooser jfc = new JFileChooser();
        jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        if (jfc.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
            picturesDirectory = new File(jfc.getSelectedFile().getAbsolutePath());
            jTextField4.setText(picturesDirectory.getAbsolutePath());

            System.out.print(picturesDirectory);
        }

    }

    @Action
    public void chooseDatabase() {

        chooseDatabaseDialog = new ChooseDatabase(this, true, "chooseDatabase");
        chooseDatabaseDialog.setLocationRelativeTo(this);
        chooseDatabaseDialog.pack();
        chooseDatabaseDialog.setVisible(true);

    }

    @Action
    public void exportMosaik() throws IOException {

        JFileChooser jfc = new JFileChooser();
        jfc.removeChoosableFileFilter(jfc.getFileFilter());
        ExampleFileFilter jpgFilter = new ExampleFileFilter("JPG", "jpg");
        ExampleFileFilter gifFilter = new ExampleFileFilter("GIF", "gif");
        ExampleFileFilter pngFilter = new ExampleFileFilter("PNG", "png");

        jfc.addChoosableFileFilter(jpgFilter);
        jfc.addChoosableFileFilter(gifFilter);
        jfc.addChoosableFileFilter(pngFilter);


        jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);

        if (jfc.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            savePathofExportedFile = new File(jfc.getSelectedFile().getAbsolutePath());
            String name = savePathofExportedFile.getName();
            int i = name.lastIndexOf('.');

            if (i > 0 && i < name.length() - 1) {
                String type = name.substring(i + 1).toLowerCase();

                if (type.equals("jpg")) {
                    ImageIO.write(mosaikImage, "jpg", savePathofExportedFile);
                    System.out.print(savePathofExportedFile);
                } else if (type.equals("png")) {
                    ImageIO.write(mosaikImage, "png", savePathofExportedFile);
                    System.out.print(savePathofExportedFile);
                } else if (type.equals("gif")) {
                    ImageIO.write(mosaikImage, "gif", savePathofExportedFile);
                    System.out.print(savePathofExportedFile);
                }
            } else if (jfc.getFileFilter().getDescription().contains("jpg")) {
                ImageIO.write(mosaikImage, "jpg", new File(savePathofExportedFile + ".jpg"));
            } else if (jfc.getFileFilter().getDescription().contains("gif")) {
                ImageIO.write(mosaikImage, "gif", new File(savePathofExportedFile + ".gif"));
            } else if (jfc.getFileFilter().getDescription().contains("png")) {
                ImageIO.write(mosaikImage, "png", new File(savePathofExportedFile + ".png"));
            }


        }
    }

    @Action
    public void showConfiguration() {

        configuration = new Configurations(this, true);
        configuration.setLocationRelativeTo(this);
        configuration.pack();
        configuration.setVisible(true);

    }
    
 @Action
    public void showAbout() {

        about = new About(this, true);
        about.setLocationRelativeTo(this);
        about.pack();
        about.setVisible(true);

    }
    @Action
    /**
     * Rizeses the image based on a faktor (%)
     */
    public void resizePicture() {
        int faktor = Integer.parseInt(jTextField1.getText());
        int h = originalPicture.getIconHeight();
        int w = originalPicture.getIconWidth();

        int newH = h / 100 * faktor;
        int newW = w / 100 * faktor;
        Image tmp = originalPicture.getImage().getScaledInstance(newW, newH, Image.SCALE_SMOOTH);
        originalPicture = new ImageIcon(tmp);
        this.jLabelForOriginalPic.setIcon(originalPicture);
        this.jLabelForOriginalPic.validate();

    }

    public void setPictureofJLabelPic() throws IOException {
        originalPicture = new ImageIcon(ImageIO.read(picturePathofTheOrinignalFile));
        this.jLabelForOriginalPic.setIcon(originalPicture);

        setPicture(jLabelOfRisizedComparePic, ImageIO.read(picturePathofTheOrinignalFile), jPanel5);
        this.jLabelOfRisizedComparePic.validate();
    }

    @Action
    /**
     * Creates the mosaiq based on the current Database file and the current displayed image.
     */
    public void createMosaik() throws FileNotFoundException, IOException, ClassNotFoundException {
        final int xparts = Integer.parseInt(jTextField1.getText());
        final int yparts = Integer.parseInt(jTextField2.getText());
        final float faktor = Integer.parseInt(jTextField3.getText()) / 100.0f;	// durch float dividieren, sonst nur Integer als ergebnis!
        jProgressBar1.setMaximum(Integer.parseInt(jTextField2.getText()));
        resetProgressbar();

        //starts a new Thread, so that the GUI is not frozen
        new TimedAction(0) {

            @Override
            public void action() throws Exception {
                //creats the mosaiq image
                mosaikImage = MosaikFunctions.makeMosaik(picturePathofTheOrinignalFile, currentdatabase, xparts, yparts, faktor);

                ImageIcon tmp = new ImageIcon(mosaikImage);
                jLabelForMosaik.setIcon(tmp);
                jLabelForMosaik.validate();
                jTabbedPane.setSelectedComponent(jScrollPaneForGeneratedPic);
                setPicture(jLabeljLabelOfRisizedCompareMosaik, mosaikImage, jPanel5);

                jButton5.setEnabled(true);
                saveMenuItem.setEnabled(true);
            }
        };


    }

    /**
     * This methode sets an image to an JLabel, which fills a given JPanel
     * @param jLabelLoadedImage1 The JLabel that containes the Image
     * @param image The Image that ist scaled and added to the JLabel, based on the propotion of the JPanel
     * @param panel The panel in which the JLabel is placed
     * @throws IOException
     */
    public void setPicture(JLabel jLabelLoadedImage1, BufferedImage image, JPanel panel) throws IOException {

        int imageW = image.getWidth();
        int imageH = image.getHeight();

        // the proportion of the image
        double proW = imageW / panel.getWidth();
        double proH = imageH / panel.getHeight();
        ImageIcon newpic;


        if (proW > proH) {
            imageH = (int) (imageH / proW);
            newpic = new ImageIcon(image.getScaledInstance(panel.getWidth(), imageH, Image.SCALE_FAST));

        } else {
            imageW = (int) (imageW / proH);
            newpic = new ImageIcon(image.getScaledInstance(imageW, panel.getHeight(), Image.SCALE_FAST));
        }

        jLabelLoadedImage1.setIcon(newpic);
        jLabelLoadedImage1.validate();

    }

    @Action
    public void saveCurrentDatabase() throws IOException {
        // Overwrites the standard values of the Look and Feel Preset
        UIManager.put("FileChooser.lookInLabelText", "Speichern in:");
        UIManager.put("FileChooser.upFolderToolTipText", "Einen Ordner aufwÃ¤rts in der Hierarchie");
        UIManager.put("FileChooser.newFolderToolTipText", "Neuen Ordner anlegen");
        UIManager.put("FileChooser.fileNameLabelText", "Dateiname:");
        UIManager.put("FileChooser.filesOfTypeLabelText", "Dateityp:");
        UIManager.put("FileChooser.cancelButtonText", "Abbrechen");
        UIManager.put("FileChooser.cancelButtonToolTipText ", "Aktion abbrechen");

        jFileChooser1 = new JFileChooser();
        // removes the default File Filter
        jFileChooser1.removeChoosableFileFilter(jFileChooser1.getFileFilter());

        // adds a custome one
        jFileChooser1.addChoosableFileFilter(new FileFilter() {

            @Override
            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                String name = f.getName();
                int i = name.lastIndexOf('.');

                if (i > 0 && i < name.length() - 1) {
                    String type = name.substring(i + 1).toLowerCase();		// shorter ;)

                    // if the file extention ends with "db"
                    if (type.equals("db")) {
                        return true;
                    }
                }
                return false;
            }

            @Override
            public String getDescription() {
                return ".db";
            }
        });
        //
        jFileChooser1.setFileSelectionMode(JFileChooser.FILES_ONLY);
        if (jFileChooser1.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            File dbDirectory = jFileChooser1.getSelectedFile();
            String name = dbDirectory.getName();
            int i = name.lastIndexOf('.');
            if (i > 0 && i < name.length() - 1) {
                String type = name.substring(i + 1).toLowerCase();

                if (type.equals("db")) {
                    MosaikFunctions.storeDatabase(currentdatabase, dbDirectory);
                    databaseDirectory = dbDirectory;

                } else {
                    JOptionPane.showMessageDialog(this,
                            "Keine gÃ¼ltige Endung eingeben.",
                            "Tipp: Lassen Sie die Endung weg, oder schreiben sie .db hinter den Dateinamen.",
                            JOptionPane.WARNING_MESSAGE);
                }

            } else {
                dbDirectory = new File(dbDirectory + ".db");
                MosaikFunctions.storeDatabase(currentdatabase, dbDirectory);
                databaseDirectory = dbDirectory;

            }

            MosaikFunctions.storeDatabase(currentdatabase, dbDirectory);
            databaseDirectory = dbDirectory;
        }
    }

    @Action
    public void creatNewDatabase_BasedOnDirectory() throws IOException {
        UIManager.put("FileChooser.lookInLabelText", "Speichern in:");
        UIManager.put("FileChooser.upFolderToolTipText", "Einen Ordner aufwÃ¤rts in der Hierarchie");
        UIManager.put("FileChooser.newFolderToolTipText", "Neuen Ordner anlegen");
        UIManager.put("FileChooser.fileNameLabelText", "Dateiname:");
        UIManager.put("FileChooser.filesOfTypeLabelText", "Dateityp:");
        UIManager.put("FileChooser.cancelButtonText", "Abbrechen");
        UIManager.put("FileChooser.cancelButtonToolTipText ", "Aktion abbrechen");

        jFileChooser1 = new JFileChooser();
        jFileChooser1.removeChoosableFileFilter(jFileChooser1.getFileFilter());
        jFileChooser1.addChoosableFileFilter(new FileFilter() {

            @Override
            public boolean accept(File f) {
                if (f.isDirectory()) {
                    return true;
                }
                String name = f.getName();
                int i = name.lastIndexOf('.');

                if (i > 0 && i < name.length() - 1) {
                    String type = name.substring(i + 1).toLowerCase();		// shorter ;)

                    // if file extension ends with "db"
                    if (type.equals("db")) {
                        return true;
                    }
                }
                return false;
            }

            @Override
            public String getDescription() {
                return ".db";
            }
        });

        jFileChooser1.setFileSelectionMode(JFileChooser.FILES_ONLY);
        if (jFileChooser1.showSaveDialog(this) == JFileChooser.APPROVE_OPTION) {
            dbDirectory = jFileChooser1.getSelectedFile();
            String name = dbDirectory.getName();
            int i = name.lastIndexOf('.');
            if (i > 0 && i < name.length() - 1) {
                String type = name.substring(i + 1).toLowerCase();

                if (type.equals("db")) {
                    // starts a new thread
                    Thread t2 = new TimedAction(0) {

                        @Override
                        public void action() throws Exception {
                            DataBase db = MosaikFunctions.makeDatabase(picturesDirectory);
                            // saves the database
                            MosaikFunctions.storeDatabase(db, dbDirectory);
                            currentdatabase = db;
                            databaseDirectory = dbDirectory;
                            jTextField5.setText(dbDirectory.getAbsolutePath());
                            enableComponents2(true);
                        }
                    };





                    // if the file extension is not correct (not "db")
                } else {
                    JOptionPane.showMessageDialog(this,
                            "Keine gÃ¼ltige Endung eingeben.",
                            "Tipp: Lassen Sie die Endung weg, oder schreiben sie .db hinter den Dateinamen.",
                            JOptionPane.WARNING_MESSAGE);
                }
                // if not file extension
            } else {
                dbDirectory = new File(dbDirectory + ".db");
                DataBase db = MosaikFunctions.makeDatabase(picturesDirectory);

                MosaikFunctions.storeDatabase(db, dbDirectory);
                currentdatabase = db;
                databaseDirectory = dbDirectory;
                jTextField5.setText(dbDirectory.getAbsolutePath());
                enableComponents2(true);
            }


        }

    }

    @Action
    /**
     * Shut down the current java virtual machine
     */
    public void exit() {

        System.exit(0);
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem aboutMenuItem;
    private javax.swing.JMenu editMenu;
    private javax.swing.JMenuItem exitMenuItem;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    protected javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabelForMosaik;
    private javax.swing.JLabel jLabelForOriginalPic;
    private javax.swing.JLabel jLabelOfRisizedComparePic;
    private javax.swing.JLabel jLabeljLabelOfRisizedCompareMosaik;
    private javax.swing.JMenuItem jMenuItemConfiguration;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanelMain;
    private javax.swing.JPanel jPanelRightMenue;
    private static javax.swing.JProgressBar jProgressBar1;
    private javax.swing.JScrollPane jScrollPaneForCompareMosaikAndLoadedPic;
    private javax.swing.JScrollPane jScrollPaneForGeneratedPic;
    private javax.swing.JScrollPane jScrollPaneForLoadedPic;
    private javax.swing.JScrollPane jScrollPaneMain;
    private javax.swing.JTabbedPane jTabbedPane;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JMenuItem openMenuItem;
    private javax.swing.JMenuItem saveCurrentDatabaseMenuItem;
    private javax.swing.JMenuItem saveMenuItem;
    // End of variables declaration//GEN-END:variables
    JDialog choosePicDialog;
    JDialog exportMosaikDialog;
    JDialog chooseDatabaseDialog;
    JDialog chooseDirectory;
    JDialog configuration;
     JDialog about;
    JDialog storeDatabase;
    File picturesDirectory;
    File databaseDirectory;
    File picturePathofTheOrinignalFile;
    File savePathofExportedFile;
    ImageIcon originalPicture;
    BufferedImage mosaikImage;
    File newDatabaseDirectory;
    DataBase currentdatabase;
    JTabbedPane test;
    static int progress = 1;
    JFileChooser jFileChooser1;
    File dbDirectory;
}
