pcd3.View.java Source code

Java tutorial

Introduction

Here is the source code for pcd3.View.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package pcd3;

import imageHelper.ImageProcessing;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.UnsupportedLookAndFeelException;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import pcd.About;

/**
 *
 * @author Yusuf Aji Wibowo
 */
public class View extends javax.swing.JFrame {

    ImageProcessing imageFormSiji = null;
    ImageProcessing imageFormLoro = null;
    ImageProcessing imageFormTelu = null;

    /**
     * Creates new form View
     */
    public View() {
        initComponents();
        setLocationRelativeTo(null);
        imageFormSiji = new ImageProcessing();
        imageFormLoro = new ImageProcessing();
        imageFormTelu = new ImageProcessing();

    }

    /**
     * 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() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        citraEkualisasi = new javax.swing.JLabel();
        citraLabel = new javax.swing.JLabel();
        chartAwal = new javax.swing.JPanel();
        ukuranCitra = new javax.swing.JLabel();
        pilihGambarCitra = new javax.swing.JButton();
        namaCitra = new javax.swing.JLabel();
        chartEkualisasi = new javax.swing.JPanel();
        citraGrayLabel = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        citraSmoothingHasil = new javax.swing.JLabel();
        citraSmoothingGray = new javax.swing.JLabel();
        citraSmoothingAwal = new javax.swing.JLabel();
        pilihGambarLoro = new javax.swing.JButton();
        namaCitraLoro = new javax.swing.JLabel();
        ukuranCitraLoro = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        citraSharpheningHasil = new javax.swing.JLabel();
        citraSharpheningGray = new javax.swing.JLabel();
        citraSharpheningAwal = new javax.swing.JLabel();
        pilihGambarSharp = new javax.swing.JButton();
        namaCitraTelu = new javax.swing.JLabel();
        ukuranCitraTelu = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Program Pengolahan Citra Digital");

        citraEkualisasi.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraEkualisasi.setText("Citra Ekualisasi");
        citraEkualisasi.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Equalisation",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        citraLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraLabel.setText("Citra Awal");
        citraLabel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Awal",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        chartAwal.setBackground(new java.awt.Color(71, 121, 163));
        chartAwal.setLayout(new java.awt.BorderLayout());

        ukuranCitra.setText("Ukuran Citra");

        pilihGambarCitra.setText("Pilih Gambar");
        pilihGambarCitra.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                pilihGambarCitraMouseClicked(evt);
            }
        });

        namaCitra.setText("Nama Citra");

        chartEkualisasi.setBackground(new java.awt.Color(71, 121, 163));
        chartEkualisasi.setLayout(new java.awt.BorderLayout());

        citraGrayLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraGrayLabel.setText("Citra Gray");
        citraGrayLabel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Gray",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // 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().addGroup(jPanel2Layout
                        .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jPanel2Layout.createSequentialGroup()
                                .addComponent(chartAwal, javax.swing.GroupLayout.PREFERRED_SIZE, 550,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(chartEkualisasi, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout
                                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addComponent(pilihGambarCitra)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(namaCitra, javax.swing.GroupLayout.PREFERRED_SIZE, 212,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(ukuranCitra, javax.swing.GroupLayout.PREFERRED_SIZE, 196,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE))
                                .addGroup(jPanel2Layout.createSequentialGroup()
                                        .addComponent(citraLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(164, 164, 164)
                                        .addComponent(citraGrayLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128,
                                                Short.MAX_VALUE)
                                        .addComponent(citraEkualisasi, javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(58, 58, 58)))))
                        .addContainerGap()));
        jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup().addContainerGap()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(pilihGambarCitra).addComponent(namaCitra).addComponent(ukuranCitra))
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(9, 9, 9)
                                        .addGroup(jPanel2Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(citraEkualisasi,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addComponent(citraGrayLabel,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(jPanel2Layout.createSequentialGroup().addGap(18, 18, 18).addComponent(
                                        citraLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 250,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(chartEkualisasi, javax.swing.GroupLayout.DEFAULT_SIZE,
                                        javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(chartAwal, javax.swing.GroupLayout.PREFERRED_SIZE, 269,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(365, 365, 365)));

        jTabbedPane1.addTab("Equalization", jPanel2);

        citraSmoothingHasil.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSmoothingHasil.setText("Citra Smooting");
        citraSmoothingHasil.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Hasil Smoothing",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        citraSmoothingGray.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSmoothingGray.setText("Citra Gray");
        citraSmoothingGray.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Gray",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        citraSmoothingAwal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSmoothingAwal.setText("Citra Awal");
        citraSmoothingAwal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Awal",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        pilihGambarLoro.setText("Pilih Gambar");
        pilihGambarLoro.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                pilihGambarLoroMouseClicked(evt);
            }
        });

        namaCitraLoro.setText("Nama Citra");

        ukuranCitraLoro.setText("Ukuran Citra");

        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(citraSmoothingAwal, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(jPanel3Layout.createSequentialGroup()
                                .addComponent(pilihGambarLoro, javax.swing.GroupLayout.PREFERRED_SIZE, 145,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(30, 30, 30).addComponent(namaCitraLoro,
                                        javax.swing.GroupLayout.PREFERRED_SIZE, 136,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup()
                                        .addComponent(citraSmoothingGray, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                350, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(20, 20, 20).addComponent(citraSmoothingHasil,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addComponent(ukuranCitraLoro, javax.swing.GroupLayout.PREFERRED_SIZE, 239,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(22, Short.MAX_VALUE)));
        jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel3Layout.createSequentialGroup().addGap(15, 15, 15)
                                        .addGroup(jPanel3Layout
                                                .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                                .addComponent(pilihGambarLoro).addComponent(namaCitraLoro)))
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                        jPanel3Layout.createSequentialGroup().addContainerGap()
                                                .addComponent(ukuranCitraLoro)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(citraSmoothingHasil, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(citraSmoothingGray, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(citraSmoothingAwal, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(189, Short.MAX_VALUE)));

        jTabbedPane1.addTab("Smoothing", jPanel3);

        citraSharpheningHasil.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSharpheningHasil.setText("Citra Sharpening");
        citraSharpheningHasil.setBorder(
                javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(null,
                        "Citra Sharpening", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                        javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11)))); // NOI18N

        citraSharpheningGray.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSharpheningGray.setText("Citra Gray");
        citraSharpheningGray.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Gray",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        citraSharpheningAwal.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        citraSharpheningAwal.setText("Citra Awal");
        citraSharpheningAwal.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Citra Awal",
                javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
                javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 11))); // NOI18N

        pilihGambarSharp.setText("Pilih Gambar");
        pilihGambarSharp.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                pilihGambarSharpMouseClicked(evt);
            }
        });

        namaCitraTelu.setText("Nama Gambar");

        ukuranCitraTelu.setText("Ukuran Citra");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(jPanel1Layout
                .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(citraSharpheningAwal, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                350, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(citraSharpheningGray, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                350, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18).addComponent(citraSharpheningHasil,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                                javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGroup(jPanel1Layout.createSequentialGroup().addContainerGap()
                                        .addComponent(pilihGambarSharp).addGap(18, 18, 18)
                                        .addComponent(namaCitraTelu, javax.swing.GroupLayout.PREFERRED_SIZE, 145,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(58, 58, 58).addComponent(ukuranCitraTelu,
                                                javax.swing.GroupLayout.PREFERRED_SIZE, 161,
                                                javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(42, Short.MAX_VALUE)));
        jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel1Layout.createSequentialGroup().addGap(5, 5, 5)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(pilihGambarSharp).addComponent(namaCitraTelu)
                                .addComponent(ukuranCitraTelu))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(citraSharpheningAwal, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(citraSharpheningGray, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(citraSharpheningHasil, javax.swing.GroupLayout.PREFERRED_SIZE, 350,
                                        javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap(204, Short.MAX_VALUE)));

        jTabbedPane1.addTab("Sharpening", jPanel1);

        jMenu1.setText("File");

        jMenuItem2.setText("Exit");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("About");

        jMenuItem1.setText("About");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        jMenu2.add(jMenuItem1);

        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jTabbedPane1));
        layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(
                jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 616, javax.swing.GroupLayout.PREFERRED_SIZE));

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

    private void pilihGambarCitraMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pilihGambarCitraMouseClicked
        final String path = "./Citra Images/form.1";

        javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
        chooser.setCurrentDirectory(new File(path));

        chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {
            public final static String jpeg = "jpeg";
            public final String jpg = "jpg";
            public final String gif = "gif";
            public final String tiff = "tiff";
            public final String tif = "tif";
            public final String png = "png";

            /*Get the extension of a file.*/
            public String getExtension(java.io.File f) {
                String ext = null;
                String s = f.getName();
                int i = s.lastIndexOf('.');

                if (i > 0 && i < s.length() - 1) {
                    ext = s.substring(i + 1).toLowerCase();
                }
                return ext;
            }

            @Override
            public String getDescription() {
                return "All Images extensions (jpg, gif, tiff, tif, png)";
            }

            @Override
            public boolean accept(java.io.File f) {
                if (f.isDirectory()) {
                    return true;
                }

                String extension = getExtension(f);
                if (extension != null) {
                    return extension.equals(tiff) || extension.equals(tif) || extension.equals(gif)
                            || extension.equals(jpeg) || extension.equals(jpg) || extension.equals(png);
                }

                return false;
            }
        });

        if (chooser.showDialog(this, "  Open  ") == javax.swing.JFileChooser.APPROVE_OPTION) {
            java.io.File file = chooser.getSelectedFile();
            String filePath = file.toString();
            try {
                final BufferedImage bimg = ImageIO.read(new File(filePath));
                namaCitra.setText("Nama Citra : " + file.getName());
                Thread t = new Thread() {
                    @Override
                    public void run() {
                        imageFormSiji.setImage(bimg);
                        imageFormSiji.imageToGray(1);
                        imageFormSiji.setHistogram();
                        int jumlah = 0;
                        DefaultCategoryDataset chartBarAwal = new DefaultCategoryDataset();
                        DefaultCategoryDataset chartBarHasil = new DefaultCategoryDataset();
                        //barChartData.setva
                        for (int i = 0; i < imageFormSiji.getHistogram().size(); i++) {
                            System.out.println(imageFormSiji.getHistogram().get(i).getRgb() + " = "
                                    + imageFormSiji.getHistogram().get(i).getJumlah() + " = "
                                    + imageFormSiji.getHistogram().get(i).getJumlahKumulatif() + " = "
                                    + imageFormSiji.getHistogram().get(i).getHasilEkualisasi());
                            jumlah += imageFormSiji.getHistogram().get(i).getJumlah();
                            chartBarAwal.setValue(imageFormSiji.getHistogram().get(i).getJumlah(), "aha",
                                    "" + imageFormSiji.getHistogram().get(i).getRgb());
                            chartBarHasil.setValue(imageFormSiji.getHistogram().get(i).getHasilEkualisasi(), "aha",
                                    "" + imageFormSiji.getHistogram().get(i).getRgb());
                        }

                        JFreeChart chartSiji = ChartFactory.createBarChart("Histogam Citra Awal", "RGB", "Jumlah",
                                chartBarAwal, PlotOrientation.VERTICAL, false, true, false);
                        JFreeChart chartLoro = ChartFactory.createBarChart("Histogram Citra Ekualisasi", "RGB",
                                "Jumlah", chartBarHasil, PlotOrientation.VERTICAL, false, true, false);
                        CategoryPlot categoryPlotSiji = chartSiji.getCategoryPlot();
                        CategoryPlot categoryPlotLoro = chartLoro.getCategoryPlot();
                        categoryPlotSiji.setRangeGridlinePaint(Color.orange);
                        categoryPlotLoro.setRangeGridlinePaint(Color.orange);

                        ChartPanel cpanelSiji = new ChartPanel(chartSiji);
                        ChartPanel cpanelLoro = new ChartPanel(chartLoro);
                        chartAwal.removeAll();
                        chartAwal.add(cpanelSiji);
                        chartAwal.validate();

                        chartEkualisasi.removeAll();
                        chartEkualisasi.add(cpanelLoro);
                        chartEkualisasi.validate();

                        System.out.println("Jumlah = " + jumlah);
                        citraLabel.setText("");
                        citraGrayLabel.setText("");
                        citraEkualisasi.setText("");
                        citraLabel.setIcon(new ImageIcon(bimg.getScaledInstance(230, 230, 0)));
                        //resetCitra();
                        ukuranCitra.setText("Ukuran Citra : " + imageFormSiji.getTinggi() + " x "
                                + imageFormSiji.getLebar() + "");
                        imageFormSiji.setSmoothingImage();
                        imageFormSiji.setSharpeningImage();
                        citraEkualisasi.setIcon(
                                new ImageIcon(imageFormSiji.getEqualImage().getScaledInstance(230, 230, 0)));
                        citraGrayLabel.setIcon(
                                new ImageIcon(imageFormSiji.getGrayImage().getScaledInstance(230, 230, 0)));
                        citraSmoothingHasil.setIcon(new ImageIcon(imageFormSiji.getSmoothingImage()));
                        citraSharpheningHasil.setIcon(new ImageIcon(imageFormSiji.getSharpeningImage()));
                    }
                };
                t.start();

            } catch (IOException e) {
                javax.swing.JOptionPane.showMessageDialog(this, "File Tidak Ditemukan " + e);
            }
        }
    }//GEN-LAST:event_pilihGambarCitraMouseClicked

    private void pilihGambarSharpMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pilihGambarSharpMouseClicked
        final String path = "./Citra Images/form.1";

        javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
        chooser.setCurrentDirectory(new File(path));

        chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {
            public final static String jpeg = "jpeg";
            public final String jpg = "jpg";
            public final String gif = "gif";
            public final String tiff = "tiff";
            public final String tif = "tif";
            public final String png = "png";

            /*Get the extension of a file.*/
            public String getExtension(java.io.File f) {
                String ext = null;
                String s = f.getName();
                int i = s.lastIndexOf('.');

                if (i > 0 && i < s.length() - 1) {
                    ext = s.substring(i + 1).toLowerCase();
                }
                return ext;
            }

            @Override
            public String getDescription() {
                return "All Images extensions (jpg, gif, tiff, tif, png)";
            }

            @Override
            public boolean accept(java.io.File f) {
                if (f.isDirectory()) {
                    return true;
                }

                String extension = getExtension(f);
                if (extension != null) {
                    return extension.equals(tiff) || extension.equals(tif) || extension.equals(gif)
                            || extension.equals(jpeg) || extension.equals(jpg) || extension.equals(png);
                }

                return false;
            }
        });

        if (chooser.showDialog(this, "  Open  ") == javax.swing.JFileChooser.APPROVE_OPTION) {
            java.io.File file = chooser.getSelectedFile();
            String filePath = file.toString();
            try {
                final BufferedImage bimg = ImageIO.read(new File(filePath));
                namaCitraTelu.setText("Nama Citra : " + file.getName());
                Thread t = new Thread() {
                    @Override
                    public void run() {
                        imageFormTelu.setImage(bimg);
                        imageFormTelu.imageToGray(1);
                        citraSharpheningAwal.setText("");
                        citraSharpheningGray.setText("");
                        citraSharpheningHasil.setText("");
                        citraSharpheningAwal.setIcon(new ImageIcon(bimg.getScaledInstance(300, 300, 0)));
                        citraSharpheningGray.setIcon(
                                new ImageIcon(imageFormTelu.getGrayImage().getScaledInstance(300, 300, 0)));
                        ukuranCitraTelu.setText("Ukuran Citra : " + imageFormTelu.getTinggi() + " x "
                                + imageFormTelu.getLebar() + "");
                        imageFormTelu.setSharpeningImage();
                        citraSharpheningHasil.setIcon(
                                new ImageIcon(imageFormTelu.getSharpeningImage().getScaledInstance(300, 300, 0)));
                    }
                };
                t.start();

            } catch (IOException e) {
                javax.swing.JOptionPane.showMessageDialog(this, "File Tidak Ditemukan " + e);
            }
        }
    }//GEN-LAST:event_pilihGambarSharpMouseClicked

    private void pilihGambarLoroMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_pilihGambarLoroMouseClicked
        final String path = "./Citra Images/form.1";

        javax.swing.JFileChooser chooser = new javax.swing.JFileChooser();
        chooser.setCurrentDirectory(new File(path));

        chooser.setFileFilter(new javax.swing.filechooser.FileFilter() {
            public final static String jpeg = "jpeg";
            public final String jpg = "jpg";
            public final String gif = "gif";
            public final String tiff = "tiff";
            public final String tif = "tif";
            public final String png = "png";

            /*Get the extension of a file.*/
            public String getExtension(java.io.File f) {
                String ext = null;
                String s = f.getName();
                int i = s.lastIndexOf('.');

                if (i > 0 && i < s.length() - 1) {
                    ext = s.substring(i + 1).toLowerCase();
                }
                return ext;
            }

            @Override
            public String getDescription() {
                return "All Images extensions (jpg, gif, tiff, tif, png)";
            }

            @Override
            public boolean accept(java.io.File f) {
                if (f.isDirectory()) {
                    return true;
                }

                String extension = getExtension(f);
                if (extension != null) {
                    return extension.equals(tiff) || extension.equals(tif) || extension.equals(gif)
                            || extension.equals(jpeg) || extension.equals(jpg) || extension.equals(png);
                }

                return false;
            }
        });

        if (chooser.showDialog(this, "  Open  ") == javax.swing.JFileChooser.APPROVE_OPTION) {
            java.io.File file = chooser.getSelectedFile();
            String filePath = file.toString();
            try {
                final BufferedImage bimg = ImageIO.read(new File(filePath));
                namaCitraLoro.setText("Nama Citra : " + file.getName());
                Thread t = new Thread() {
                    @Override
                    public void run() {
                        imageFormLoro.setImage(bimg);
                        imageFormLoro.imageToGray(1);
                        citraSmoothingAwal.setText("");
                        citraSmoothingGray.setText("");
                        citraSmoothingHasil.setText("");
                        citraSmoothingAwal.setIcon(new ImageIcon(bimg.getScaledInstance(300, 300, 0)));
                        citraSmoothingGray.setIcon(
                                new ImageIcon(imageFormLoro.getGrayImage().getScaledInstance(300, 300, 0)));
                        ukuranCitraLoro.setText("Ukuran Citra : " + imageFormLoro.getTinggi() + " x "
                                + imageFormLoro.getLebar() + "");
                        imageFormLoro.setSmoothingImage();
                        citraSmoothingHasil.setIcon(
                                new ImageIcon(imageFormLoro.getSmoothingImage().getScaledInstance(300, 300, 0)));
                    }
                };
                t.start();

            } catch (IOException e) {
                javax.swing.JOptionPane.showMessageDialog(this, "File Tidak Ditemukan " + e);
            }
        }
    }//GEN-LAST:event_pilihGambarLoroMouseClicked

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        About about = new About(null, rootPaneCheckingEnabled);
        about.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

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

    /**
     * @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("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
        } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                | javax.swing.UnsupportedLookAndFeelException ex) {
            try {
                javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException ex1) {
                Logger.getLogger(pcd.View.class.getName()).log(Level.SEVERE, null, ex1);
            }
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
                new View().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel chartAwal;
    private javax.swing.JPanel chartEkualisasi;
    private javax.swing.JLabel citraEkualisasi;
    private javax.swing.JLabel citraGrayLabel;
    private javax.swing.JLabel citraLabel;
    private javax.swing.JLabel citraSharpheningAwal;
    private javax.swing.JLabel citraSharpheningGray;
    private javax.swing.JLabel citraSharpheningHasil;
    private javax.swing.JLabel citraSmoothingAwal;
    private javax.swing.JLabel citraSmoothingGray;
    private javax.swing.JLabel citraSmoothingHasil;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JLabel namaCitra;
    private javax.swing.JLabel namaCitraLoro;
    private javax.swing.JLabel namaCitraTelu;
    private javax.swing.JButton pilihGambarCitra;
    private javax.swing.JButton pilihGambarLoro;
    private javax.swing.JButton pilihGambarSharp;
    private javax.swing.JLabel ukuranCitra;
    private javax.swing.JLabel ukuranCitraLoro;
    private javax.swing.JLabel ukuranCitraTelu;
    // End of variables declaration//GEN-END:variables

}