Example #1
0
 private void ChoosePicture2ButtonActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_ChoosePicture2ButtonActionPerformed
   // TODO add your handling code here:
   try {
     image2 = new PaletteImage();
     if (image2 != null)
       SecretLabel.setText(image2.getWidth() + "x" + image2.getHeight() + " pixels");
   } catch (IOException ex) {
     Logger.getLogger(PSNR.class.getName()).log(Level.SEVERE, null, ex);
   }
 } // GEN-LAST:event_ChoosePicture2ButtonActionPerformed
Example #2
0
  /**
   * 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() {

    OriginalLabel = new javax.swing.JLabel();
    SecretLabel = new javax.swing.JLabel();
    ChoosePicture1Button = new javax.swing.JButton();
    ChoosePicture2Button = new javax.swing.JButton();
    EmbeFileButton = new javax.swing.JButton();
    psnrLabel = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("PSNR Calculator");
    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosed(java.awt.event.WindowEvent evt) {
            formWindowClosed(evt);
          }
        });

    OriginalLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    OriginalLabel.setText("Gimme a picture");

    SecretLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    SecretLabel.setText("Gimme another picture");

    ChoosePicture1Button.setText("Choose Picture 1");
    ChoosePicture1Button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChoosePicture1ButtonActionPerformed(evt);
          }
        });

    ChoosePicture2Button.setText("Choose Picture 2");
    ChoosePicture2Button.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            ChoosePicture2ButtonActionPerformed(evt);
          }
        });

    EmbeFileButton.setText("Calculate PSNR");
    EmbeFileButton.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(java.awt.event.ActionEvent evt) {
            EmbeFileButtonActionPerformed(evt);
          }
        });

    psnrLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    psnrLabel.setText("Press Calculate PSNR");

    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .add(20, 20, 20)
                    .add(
                        layout
                            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                            .add(
                                ChoosePicture1Button,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                165,
                                Short.MAX_VALUE)
                            .add(
                                SecretLabel,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                OriginalLabel,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                ChoosePicture2Button,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                psnrLabel,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE)
                            .add(
                                EmbeFileButton,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
                                Short.MAX_VALUE))
                    .addContainerGap(28, Short.MAX_VALUE)));
    layout.setVerticalGroup(
        layout
            .createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(
                layout
                    .createSequentialGroup()
                    .add(22, 22, 22)
                    .add(OriginalLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(ChoosePicture1Button)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(SecretLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(ChoosePicture2Button)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                    .add(psnrLabel)
                    .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                    .add(EmbeFileButton)
                    .addContainerGap(25, Short.MAX_VALUE)));

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