Package org.bric.gui

Source Code of org.bric.gui.BricUI

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package org.bric.gui;

import java.awt.Desktop;
import java.awt.Toolkit;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
import org.bric.gui.output.ProgressBarFrame;
import org.bric.gui.preferences.PreferencesFrame;
import org.bric.gui.tabs.*;
import org.bric.imageEditParameters.*;
import org.bric.input.ImportedImage;
import org.bric.processor.ImageProcessHandler;
import org.bric.utils.ArrayListTransferHandler;
import org.bric.utils.Utils;

/**
*
* @author vasilis
*/
public class BricUI extends JFrame {

    DefaultListModel model = new DefaultListModel();
    static int duplicateAction = Utils.NOT_SET;
    int previewState;
    public final ImageIcon DEFAULT_ICON = new javax.swing.ImageIcon(getClass().getResource("/resource/preview.png"));
    private PreferencesFrame preferencesFrame = new PreferencesFrame();
    private About aboutFrame = new About();
    public static String lastOpenedDirectory = "";
   
    List<String> imagesList;
    ArrayListTransferHandler arrayListHandler;
   
    JFileChooser propertiesChooser;
    Properties properties;
   
    Locale greek = new Locale("el", "GR");
   
    /**
     * Creates new form Main
     */
    public BricUI() {
       
//        Locale.setDefault(greek);
       
        initComponents();
        arrayListHandler = new ArrayListTransferHandler();
        jList1.setModel(model);
        jList1.setTransferHandler(arrayListHandler);
        jList1.setDragEnabled(true);
        jTabbedPane1.add("Output", new OutputJPanel());
        jTabbedPane1.add("Resize", new ResizeJPanel());
        jTabbedPane1.add("Rotate", new RotateJPanel());
        jTabbedPane1.add("Watermark", new WatermarkJPanel());
        properties = new Properties();
       
        this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resource/logo.png")));
        initializeProperties();
    }

    /**
     * This method is called from within the construfontChooserctor 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() {

        jPanel1 = new javax.swing.JPanel();
        jToggleButton1 = new javax.swing.JToggleButton();
        jButton5 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jSplitPane1 = new javax.swing.JSplitPane();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel8 = new javax.swing.JPanel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextPane1 = new javax.swing.JTextPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        java.util.ResourceBundle bundle = java.util.ResourceBundle.getBundle("lang/gui/Bundle"); // NOI18N
        setTitle(bundle.getString("BricUI.title")); // NOI18N

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jToggleButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/clasp.png"))); // NOI18N
        jToggleButton1.setText(bundle.getString("BricUI.jToggleButton1.text")); // NOI18N
        jToggleButton1.setToolTipText(bundle.getString("BricUI.jToggleButton1.toolTipText")); // NOI18N
        jToggleButton1.setBorderPainted(false);
        jToggleButton1.setContentAreaFilled(false);
        jToggleButton1.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/clasp_r.png"))); // NOI18N
        jToggleButton1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/clasp_r.png"))); // NOI18N
        jToggleButton1.setRolloverSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/clasp_r.png"))); // NOI18N
        jToggleButton1.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/clasp_p.png"))); // NOI18N
        jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton1ActionPerformed(evt);
            }
        });

        jButton5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/refresh.png"))); // NOI18N
        jButton5.setText(bundle.getString("BricUI.jButton5.text")); // NOI18N
        jButton5.setToolTipText(bundle.getString("BricUI.jButton5.toolTipText")); // NOI18N
        jButton5.setBorderPainted(false);
        jButton5.setContentAreaFilled(false);
        jButton5.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/refresh_p.png"))); // NOI18N
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/configuration.png"))); // NOI18N
        jButton6.setText(bundle.getString("BricUI.jButton6.text")); // NOI18N
        jButton6.setToolTipText(bundle.getString("BricUI.jButton6.toolTipText")); // NOI18N
        jButton6.setBorderPainted(false);
        jButton6.setContentAreaFilled(false);
        jButton6.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/configuration_p.png"))); // NOI18N
        jButton6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton6ActionPerformed(evt);
            }
        });

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/tick.png"))); // NOI18N
        jButton7.setText(bundle.getString("BricUI.jButton7.text")); // NOI18N
        jButton7.setToolTipText(bundle.getString("BricUI.jButton7.toolTipText")); // NOI18N
        jButton7.setBorderPainted(false);
        jButton7.setContentAreaFilled(false);
        jButton7.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/tick_p.png"))); // NOI18N
        jButton7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton7ActionPerformed(evt);
            }
        });

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/photo-camera.png"))); // NOI18N
        jButton4.setText(bundle.getString("BricUI.jButton4.text")); // NOI18N
        jButton4.setToolTipText(bundle.getString("BricUI.jButton4.toolTipText")); // NOI18N
        jButton4.setBorderPainted(false);
        jButton4.setContentAreaFilled(false);
        jButton4.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/photo-camera_p.png"))); // NOI18N
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/disc-floopy.png"))); // NOI18N
        jButton8.setText(bundle.getString("BricUI.jButton8.text")); // NOI18N
        jButton8.setToolTipText(bundle.getString("BricUI.jButton8.toolTipText")); // NOI18N
        jButton8.setBorderPainted(false);
        jButton8.setContentAreaFilled(false);
        jButton8.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/disc-floopy_p.png"))); // NOI18N
        jButton8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton8ActionPerformed(evt);
            }
        });

        jButton9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/disc-cd.png"))); // NOI18N
        jButton9.setText(bundle.getString("BricUI.jButton9.text")); // NOI18N
        jButton9.setToolTipText(bundle.getString("BricUI.jButton9.toolTipText")); // NOI18N
        jButton9.setBorderPainted(false);
        jButton9.setContentAreaFilled(false);
        jButton9.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/disc-cd_p.png"))); // NOI18N
        jButton9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton9ActionPerformed(evt);
            }
        });

        jButton10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/info.png"))); // NOI18N
        jButton10.setToolTipText(bundle.getString("BricUI.jButton10.toolTipText")); // NOI18N
        jButton10.setBorderPainted(false);
        jButton10.setContentAreaFilled(false);
        jButton10.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/info_p.png"))); // NOI18N
        jButton10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton10ActionPerformed(evt);
            }
        });

        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(jButton6, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton10, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToggleButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(210, 210, 210)
                .addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton7, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(9, 9, 9))
        );

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

        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jToggleButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButton5)
                            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jButton4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton9, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(jButton10, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );

        jSplitPane1.setDividerLocation(355);
        jSplitPane1.setResizeWeight(0.3);

        jTabbedPane1.setMinimumSize(new java.awt.Dimension(370, 480));
        jSplitPane1.setRightComponent(jTabbedPane1);

        jPanel8.setMinimumSize(new java.awt.Dimension(355, 480));

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/add.png"))); // NOI18N
        jButton1.setText(bundle.getString("BricUI.jButton1.text")); // NOI18N
        jButton1.setToolTipText(bundle.getString("BricUI.jButton1.toolTipText")); // NOI18N
        jButton1.setBorderPainted(false);
        jButton1.setContentAreaFilled(false);
        jButton1.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/add_p.png"))); // NOI18N
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/remove.png"))); // NOI18N
        jButton2.setText(bundle.getString("BricUI.jButton2.text")); // NOI18N
        jButton2.setToolTipText(bundle.getString("BricUI.jButton2.toolTipText")); // NOI18N
        jButton2.setBorderPainted(false);
        jButton2.setContentAreaFilled(false);
        jButton2.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/remove_p.png"))); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/error.png"))); // NOI18N
        jButton3.setText(bundle.getString("BricUI.jButton3.text")); // NOI18N
        jButton3.setToolTipText(bundle.getString("BricUI.jButton3.toolTipText")); // NOI18N
        jButton3.setBorderPainted(false);
        jButton3.setContentAreaFilled(false);
        jButton3.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/icons/error_p.png"))); // NOI18N
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("DejaVu Sans Light", 0, 14)); // NOI18N
        jLabel1.setText(bundle.getString("BricUI.jLabel1.text")); // NOI18N

        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jPanel2.setMinimumSize(new java.awt.Dimension(167, 136));

        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/resource/preview.png"))); // NOI18N
        jLabel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jLabel2.setMaximumSize(new java.awt.Dimension(130, 130));
        jLabel2.setMinimumSize(new java.awt.Dimension(130, 130));
        jLabel2.setPreferredSize(new java.awt.Dimension(130, 130));

        jTextPane1.setEditable(false);
        jTextPane1.setContentType(bundle.getString("BricUI.jTextPane1.contentType")); // NOI18N
        jTextPane1.setMinimumSize(new java.awt.Dimension(6, 128));
        jTextPane1.setPreferredSize(new java.awt.Dimension(6, 128));
        jScrollPane2.setViewportView(jTextPane1);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
        );

        jList1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jList1MouseClicked(evt);
            }
        });
        jList1.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jList1ValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(jList1);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel1)
                .addContainerGap())
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 366, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jLabel1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(2, 2, 2))
        );

        jSplitPane1.setLeftComponent(jPanel8);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jSplitPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 731, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jSplitPane1)
                .addGap(0, 0, 0)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

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

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        importImages();
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        try {
            removeImages();
        } catch (Exception e) {
            jLabel2.setIcon(DEFAULT_ICON);
        }
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        try {
            clearAll();
        } catch (Exception e) {
            jLabel2.setIcon(DEFAULT_ICON);
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton6ActionPerformed
        preferencesFrame.setVisible(true);
    }//GEN-LAST:event_jButton6ActionPerformed

    private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
        this.setAlwaysOnTop(jToggleButton1.isSelected());
    }//GEN-LAST:event_jToggleButton1ActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        previewState++;
        switch (previewState) {
            case 0:
                jLabel2.setVisible(true);
                jPanel2.setVisible(true);
                break;
            case 1:
                jLabel2.setVisible(false);
                break;
            case 2:
                jLabel2.setVisible(false);
                jPanel2.setVisible(false);
                break;
            case 3:
                previewState = 0;
            default:
                jLabel2.setVisible(true);
                jPanel2.setVisible(true);
        }
    }//GEN-LAST:event_jButton5ActionPerformed

    private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton7ActionPerformed
        if(!model.isEmpty()){
            startProcess(false);
        }
    }//GEN-LAST:event_jButton7ActionPerformed


    private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jList1ValueChanged
        try {
            ImportedImage importedImage = (ImportedImage) model.get(jList1.getSelectedIndex());
           
            generateThumbnailMetadataOnDemand(importedImage);
           
            jLabel2.setIcon(importedImage.getThumbnailImageIcon());
            previewInfo(importedImage.getPath(), importedImage.getDimensions(), importedImage.getSize());
        } catch (Exception e) {
            jLabel2.setIcon(DEFAULT_ICON);
        }
    }//GEN-LAST:event_jList1ValueChanged

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        if(jList1.getSelectedValue() != null){
            startProcess(true);
        }
    }//GEN-LAST:event_jButton4ActionPerformed

    private void jList1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MouseClicked
        if (evt.getClickCount() == 2) {
            try {
                if(model.isEmpty()){
                   return;
                }
                ImportedImage image = (ImportedImage) model.get(jList1.getSelectedIndex());
                Desktop.getDesktop().open(new File(image.getPath()));
            } catch (IOException ex) {
                Logger.getLogger(BricUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }//GEN-LAST:event_jList1MouseClicked

    private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton8ActionPerformed
        saveSettings();
    }//GEN-LAST:event_jButton8ActionPerformed

    private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton9ActionPerformed
        loadSettings();
    }//GEN-LAST:event_jButton9ActionPerformed

    private void jButton10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton10ActionPerformed
        aboutFrame.setVisible(true);
    }//GEN-LAST:event_jButton10ActionPerformed

    /**
     * @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 {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(BricUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(BricUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(BricUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(BricUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

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

            @Override
            public void run() {
                JFrame bricUI = new BricUI();
                Utils.centerWindow(bricUI);
                bricUI.setVisible(true);
            }
        });
    }
   
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton5;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextPane jTextPane1;
    private javax.swing.JToggleButton jToggleButton1;
    // End of variables declaration//GEN-END:variables

    synchronized public static void duplicatePane(String file) {

        if (duplicateAction == Utils.NOT_SET || duplicateAction == Utils.REPLACE || duplicateAction == Utils.SKIP) {

            Object[] selectionValues = {"Replace all", "Replace",
                "Skip all", "Skip"};

            String initialSelection = selectionValues[0].toString();

            Object selection;

            do{
            selection = JOptionPane.showInputDialog(
                    null, String.format("This image\n%s\nhas already been added", file),
                    "Warning Duplicate Input", JOptionPane.QUESTION_MESSAGE, null, selectionValues, initialSelection);
            } while(selection == null);
           
            int answer = 0;
            int i = 0;

            for (Object value : selectionValues) {
                if (selection == value.toString()) {
                    answer = i;
                }
                i++;
            }
            switch (answer) {
                case 0:
                    duplicateAction = Utils.REPLACE_ALL;
                    break;
                case 1:
                    duplicateAction = Utils.REPLACE;
                    break;
                case 2:
                    duplicateAction = Utils.SKIP_ALL;
                    break;
                case 3:
                    duplicateAction = Utils.SKIP;
                    break;
                default:
                    duplicateAction = Utils.NOT_SET;
            }
        }
    }

    private void removeImages() {
        ArrayList<Integer> toBeDeleted = new ArrayList<Integer>();

        for (int number : jList1.getSelectedIndices()) {
            toBeDeleted.add(number);
        }

        Collections.reverse(toBeDeleted);

        for (int value : toBeDeleted) {
            removeFromHash(((ImportedImage)model.get(value)).getPath());
            model.remove(value);
           
        }

        jTextPane1.setText("");
        updateItemsLabel();
    }

    private void updateItemsLabel() {
        jLabel1.setText("Items: " + model.getSize());

        if (model.getSize() == 0) {
            duplicateAction = Utils.NOT_SET;
        }
    }

    private void clearAll() {
        model.clear();
        imagesList.clear();
        clearHash();
        System.gc();
        jTextPane1.setText("");
        updateItemsLabel();
    }

    //Not Ready
    private void previewInfo(String listSelected, String dimensions, long filesize) {
        String text = "<html><body>";
        text += "<b>Name:</b><br />";
        text += listSelected.substring(listSelected.lastIndexOf(Utils.FS) + 1, listSelected.length()) + "<br /><br />";
        text += "<b>Dimensions: </b><br />" + dimensions + "<br />";
        if (filesize != 0) {
            text += "<br /><b>Filesize: </b><br />" + filesize / 1024 + "KB<br />";
        }
        text += "</body></html>";
        jTextPane1.setText(text);
        jTextPane1.setCaretPosition(0);
    }
   
    public void importImages(){
        imagesList = readImages();
       
        if(imagesList == Collections.EMPTY_LIST){
            return;
        }
       
        Thread a  = new Thread(new Runnable() {

            @Override
            public void run() {
                final ProgressBarFrame importer = new ProgressBarFrame();
                importer.setImagesCount(imagesList.size());
                importer.setVisible(true);

                int processors;
                if(Utils.prefs.getInt("importNumThreads", 0) == 0){
                    processors = Runtime.getRuntime().availableProcessors();
                } else {
                    processors = Utils.prefs.getInt("importNumThreads", 1);
                }
                final int step = (int) Math.ceil((double) imagesList.size() / processors);

                for (int j = 0; j < imagesList.size(); j += step) {
                    importImageThread(importer, j, step);
                }
            }
        });
        a.start();
    }
   
    private void importImageThread(final ProgressBarFrame importer, final int from, final int step) {
        new Thread(new Runnable() {

            @Override
            public void run() {
                for (int i = from; i < from + step; i++) {
                    if (!importer.isVisible()) {
                        return;
                    }
                    if (i < imagesList.size()) {
                       
                        if (hash.contains(imagesList.get(i))) {
                            duplicatePane(imagesList.get(i));
                        }

                        if (duplicateAction == Utils.REPLACE || duplicateAction == Utils.REPLACE_ALL || !hash.contains(imagesList.get(i))) {
                            ImportedImage im = new ImportedImage( imagesList.get(i) );
                            if(!im.isCorrupted()){
                                addToModel(im);
                                importer.updateValue(true);
                            }else{
                                importer.updateValue(false);
                            }
                        } else {
                            importer.updateValue(true);
                        }
                       
                        importer.showProgress(imagesList.get(i));
                    } else {
                        break;
                    }
                }
               
            }
        }).start();
    }
   
    private static HashSet<String> hash = new HashSet<String>();
   
    public static void removeFromHash(String path){
        hash.remove(path);
    }
   
    public static void clearHash(){
        hash.clear();
    }
   
    public synchronized void addToModel(final ImportedImage im) {
        SwingUtilities.invokeLater(new Runnable() {
            @Override
            public void run() {
                if(hash.contains(im.getPath())){
                    model.removeElement(im);
                } else {
                    hash.add(im.getPath());
                }
                model.addElement(im);
                updateItemsLabel();
            }
        });
    }
   
    public List<String> readImages(){
        ArrayList<String> imagePaths = new ArrayList<String>();
        JFileChooser chooser = new JFileChooser(lastOpenedDirectory);
        Utils.setFileChooserProperties(chooser);
        //Open the dialog
        if (chooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
            return Collections.EMPTY_LIST;
        }
        lastOpenedDirectory = chooser.getSelectedFile().getParent();
       
        for(File path : chooser.getSelectedFiles()){
            if(path.isDirectory()){
                ArrayList<String> directoryChildren = new ArrayList<String>();
                scanDirectory(path, directoryChildren);
                imagePaths.addAll(directoryChildren);
            }else{
                imagePaths.add(path.getPath());
            }
        }
        return imagePaths;
    }
   
    private void generateThumbnailMetadataOnDemand(ImportedImage importedImage){
        boolean thumbnail = Utils.prefs.getBoolean("thumbnail", true)
                && Utils.prefs.getInt("thumbWay", 0) == 1
                && importedImage.getThumbnailImageIcon() == null;

        boolean metadata = Utils.prefs.getBoolean("metadata", true)
                && Utils.prefs.getInt("metaWay", 0) == 1
                && importedImage.getDimensions().equals("unknown");

        Utils.setMetadataThumbnail(importedImage, metadata, thumbnail);
    }
   
    private void scanDirectory(File file, ArrayList<String> list) {
        File[] children = file.listFiles();

        if (children == null) {
            return;
        }

        for (File child : children) {
            if (child.isFile() && child.getName().contains(".")) {
                String extension = child.toString().substring(child.toString().lastIndexOf('.') + 1);
                for(String ext : Utils.supportedInputExtensions){
                    if(ext.equalsIgnoreCase(extension)){
                        list.add(child.getPath());
                    }
                }
            } else if (child.isDirectory()) {
                scanDirectory(child, list);
            }
        }
    }
   
    public void startProcess(final boolean preview){
        new Thread(new Runnable() {

            @Override
            public void run() {
               
                ImageProcessHandler mainProcess;
               
                if(!preview){
                    mainProcess = new ImageProcessHandler(model);
                } else {
                    ImportedImage importedImage = (ImportedImage) model.get(jList1.getSelectedIndex());
                    mainProcess = new ImageProcessHandler(importedImage);
                }
                OutputParameters outputParameters = null;
                ResizeParameters resizeParameters = null;
                RotateParameters rotateParameters = null;
                WatermarkParameters watermarkParameters = null;

                for (int i = 0; i < jTabbedPane1.getComponentCount(); i++) {
                    ImageEditParameters imageEditParameters = ((ImageEditTab) jTabbedPane1.getComponentAt(i)).getImageEditParameters();
                    if (imageEditParameters instanceof OutputParameters) {
                        outputParameters = (OutputParameters) imageEditParameters;
                    } else if (imageEditParameters instanceof ResizeParameters) {
                        resizeParameters = (ResizeParameters) imageEditParameters;
                    } else if (imageEditParameters instanceof RotateParameters) {
                        rotateParameters = (RotateParameters) imageEditParameters;
                    } else if (imageEditParameters instanceof WatermarkParameters) {
                        watermarkParameters = (WatermarkParameters) imageEditParameters;
                    }
                }

                mainProcess.setResizeParameters(resizeParameters);
                mainProcess.setRotateParameters(rotateParameters);
                mainProcess.setWatermarkParameters(watermarkParameters);
                mainProcess.setOutputParameters(outputParameters);
               
                mainProcess.start();
               
            }
        }).start();
    }
   
    private void initializeProperties(){
        propertiesChooser = new JFileChooser();
        propertiesChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        propertiesChooser.setFileFilter(new FileNameExtensionFilter("properties file(*.properties)", "PROPERTIES"));
    }
   
    private void saveSettings() {
        FileOutputStream out = null;
        try {
            propertiesChooser.setDialogTitle("Save properties");
           
            if (propertiesChooser.showSaveDialog(null) != JFileChooser.APPROVE_OPTION) {
                return;
            }
            String file = propertiesChooser.getSelectedFile().getPath();
            if(!file.matches(".+\\.properties")){
                file = propertiesChooser.getSelectedFile().getPath()+".properties";
            }
            out = new FileOutputStream(new File(file));
           
            OutputJPanel outputJPanel = (OutputJPanel) jTabbedPane1.getComponentAt(0);
            properties.setProperty("fileTypeCombo", Integer.toString(outputJPanel.getFileTypeComboIndex()));
            properties.setProperty("outputPathText", outputJPanel.getOutputPathText());
            properties.setProperty("qualityValue", Integer.toString(outputJPanel.getQualitySliderValue()));
            properties.setProperty("startIndexValue", Integer.toString(outputJPanel.getStartIndexSpinnerValue()));
           
            ResizeJPanel resizeJPanel = (ResizeJPanel) jTabbedPane1.getComponentAt(1);
            properties.setProperty("resizeAntialising", resizeJPanel.getAntialisingCheckBox() == true ? "1" : "0");
            properties.setProperty("resizeAspect", resizeJPanel.getAspectCheckBox() == true ? "1" : "0");
            properties.setProperty("resizeHeight", resizeJPanel.getHeightSpinner());
            properties.setProperty("resizeOrientation", resizeJPanel.getOrientationCheckBox() == true ? "1" : "0");
            properties.setProperty("resizeRendering", Integer.toString(resizeJPanel.getRenderingComboBox()));
            properties.setProperty("resizeEnable", resizeJPanel.getResizeEnableCheckBox() == true ? "1" : "0");
            properties.setProperty("resizeFilter", Integer.toString(resizeJPanel.getResizeFilterComboBox()));
            properties.setProperty("resizeSharpen", Integer.toString(resizeJPanel.getSharpenComboBox()));
            properties.setProperty("resizeUnits", Integer.toString(resizeJPanel.getUnitCombo()));
            properties.setProperty("resizeWidth", resizeJPanel.getWidthSpinner());
           
            RotateJPanel rotateJPanel = (RotateJPanel) jTabbedPane1.getComponentAt(2);
            properties.setProperty("rotateEnable", rotateJPanel.getRotateEnableCheckBox() == true ? "1" : "0");
            properties.setProperty("rotateAction", Integer.toString(rotateJPanel.getActionsComboBox()));
            properties.setProperty("rotateAngle", rotateJPanel.getAngleSlider());
            properties.setProperty("rotateCustom", rotateJPanel.getCustomRadioButton() == true ? "1" : "0");
            properties.setProperty("rotateDifferentValue", rotateJPanel.getDifferentValueCheckBox() == true ? "1" : "0");
            properties.setProperty("rotateMinLimit", rotateJPanel.getFromSpinner());
            properties.setProperty("rotateLimit", rotateJPanel.getLimitCheckBox() == true ? "1" : "0");
            properties.setProperty("rotatePredifiend", rotateJPanel.getPredefinedRadioButton() == true ? "1" : "0");
            properties.setProperty("rotateRandom", rotateJPanel.getRandomCheckBox() == true ? "1" : "0");
            properties.setProperty("rotateMaxLimit", rotateJPanel.getToSpinner());
           
            WatermarkJPanel watermarkJPanel = (WatermarkJPanel) jTabbedPane1.getComponentAt(3);
            properties.setProperty("watermarkColoumns", watermarkJPanel.getColoumnsSpinner());
            properties.setProperty("watermarkText", watermarkJPanel.getEditorTextPane());
            properties.setProperty("watermarkMode", Integer.toString(watermarkJPanel.getModeComboBox()));
            properties.setProperty("watermarkOpacity", watermarkJPanel.getOpacitySlider());
            properties.setProperty("watermarkPattern", Integer.toString(watermarkJPanel.getPatternComboBox()));
            properties.setProperty("watermarkRows", watermarkJPanel.getRowsSlidder());
            properties.setProperty("watermarkEnable", watermarkJPanel.getWatermarkEnableCheckBox() == true ? "1" : "0");
            properties.setProperty("watermarkImage", watermarkJPanel.getWatermarkImageText());
           
            properties.store(out, "");
        } catch (IOException ex) {
            Logger.getLogger(BricUI.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if(out != null){
                    out.close();
                }
            } catch (IOException ex) {
                Logger.getLogger(BricUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    private void loadSettings() {
        FileInputStream fileInput = null;
        try {
            propertiesChooser.setDialogTitle("Load properties");

            if (propertiesChooser.showOpenDialog(null) != JFileChooser.APPROVE_OPTION) {
                return;
            }
           
            File file = propertiesChooser.getSelectedFile();
            fileInput = new FileInputStream(file);
            properties.load(fileInput);
           
            OutputJPanel outputJPanel = (OutputJPanel) jTabbedPane1.getComponentAt(0);
            outputJPanel.setFileTypeComboIndex(properties.getProperty("fileTypeCombo"));
            outputJPanel.setOutputPathText(properties.getProperty("outputPathText"));
            outputJPanel.setQualitySliderValue(properties.getProperty("qualityValue"));
            outputJPanel.setStartIndexSpinnerValue(Integer.parseInt(properties.getProperty("startIndexValue")));
           
            ResizeJPanel resizeJPanel = (ResizeJPanel) jTabbedPane1.getComponentAt(1);
            resizeJPanel.setAntialisingCheckBox(properties.getProperty("resizeAntialising").equals("1") ? true : false);
            resizeJPanel.setAspectCheckBox(properties.getProperty("resizeAspect").equals("1") ? true : false);
            resizeJPanel.setHeightSpinner(properties.getProperty("resizeHeight"));
            resizeJPanel.setOrientationCheckBox(properties.getProperty("resizeOrientation").equals("1") ? true : false);
            resizeJPanel.setRenderingComboBox(Integer.parseInt(properties.getProperty("resizeRendering")));
            resizeJPanel.setResizeEnableCheckBox(properties.getProperty("resizeEnable").equals("1") ? true : false);
            resizeJPanel.setResizeFilterComboBox(Integer.parseInt(properties.getProperty("resizeFilter")));
            resizeJPanel.setSharpenComboBox(Integer.parseInt(properties.getProperty("resizeSharpen")));
            resizeJPanel.setUnitCombo(Integer.parseInt(properties.getProperty("resizeUnits")));
            resizeJPanel.setWidthSpinner(Integer.parseInt(properties.getProperty("resizeWidth")));
                   
            RotateJPanel rotateJPanel = (RotateJPanel) jTabbedPane1.getComponentAt(2);
            rotateJPanel.setRotateEnableCheckBox(properties.getProperty("rotateEnable").equals("1") ? true : false);
            rotateJPanel.setActionsComboBox(Integer.parseInt(properties.getProperty("rotateAction")));
            rotateJPanel.setAngleSlider(Integer.parseInt(properties.getProperty("rotateAngle")));
            rotateJPanel.setCustomRadioButton(properties.getProperty("rotateCustom").equals("1") ? true : false);
            rotateJPanel.setDifferentValueCheckBox(properties.getProperty("rotateDifferentValue").equals("1") ? true : false);
            rotateJPanel.setFromSpinner(Integer.parseInt(properties.getProperty("rotateMinLimit")));
            rotateJPanel.setLimitCheckBox(properties.getProperty("rotateLimit").equals("1") ? true : false);
            rotateJPanel.setPredefinedRadioButton(properties.getProperty("rotatePredifiend").equals("1") ? true : false);
            rotateJPanel.setRandomCheckBox(properties.getProperty("rotateRandom").equals("1") ? true : false);
            rotateJPanel.setToSpinner(Integer.parseInt(properties.getProperty("rotateMaxLimit")));
           
            WatermarkJPanel watermarkJPanel = (WatermarkJPanel) jTabbedPane1.getComponentAt(3);
            watermarkJPanel.setColoumnsSpinner(Integer.parseInt(properties.getProperty("watermarkColoumns")));
            watermarkJPanel.setEditorTextPane(properties.getProperty("watermarkText"));
            watermarkJPanel.setModeComboBox(Integer.parseInt(properties.getProperty("watermarkMode")));
            watermarkJPanel.setOpacitySlider(Integer.parseInt(properties.getProperty("watermarkOpacity")));
            watermarkJPanel.setPatternComboBox(Integer.parseInt(properties.getProperty("watermarkPattern")));
            watermarkJPanel.setRowsSlider(Integer.parseInt(properties.getProperty("watermarkRows")));
            watermarkJPanel.setWatermarkEnableCheckBox(properties.getProperty("watermarkEnable").equals("1") ? true : false);
            watermarkJPanel.setWatermarkImageText(properties.getProperty("watermarkImage"));
           
        } catch (IOException ex) {
            Logger.getLogger(BricUI.class.getName()).log(Level.SEVERE, null, ex);
        } finally {
            try {
                if(fileInput != null){
                    fileInput.close();
                }
            } catch (IOException ex) {
                Logger.getLogger(BricUI.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
TOP

Related Classes of org.bric.gui.BricUI

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.