Please take time to read the code disclaimer.

<--Go back to Kent's Projects

<--Go back to project post

/**
 * StartFrame.java
 *
 * Created on Nov 1, 2011, 8:46:33 AM
 */
package broadscope;

import encodergui.EncodeFrame;
import metagui.DescriptionFrame;
import javax.swing.*;

/**
 *
 * @author Video
 */
public class StartFrame extends javax.swing.JFrame {

  private JLabel logo = new JLabel();
  
  /** 
   * Creates new form StartFrame 
   */
  @SuppressWarnings("LeakingThisInConstructor")
  public StartFrame() {
    initComponents();
    StaticClass.addFullLogo(getContentPane(), getClass(), true, 275, java.awt.GridBagConstraints.CENTER, true);
    StaticClass.setUnifiedColor(this, java.awt.Color.white);
    StaticClass.centerAndPack(this);
  }

  /** 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")
    // //GEN-BEGIN:initComponents
    private void initComponents() {
        java.awt.GridBagConstraints gridBagConstraints;

        choicesRadioButtonGroup = new javax.swing.ButtonGroup();
        infoPanel = new javax.swing.JPanel();
        infoLabel1 = new javax.swing.JLabel();
        infoLabel2 = new javax.swing.JLabel();
        infoLabel3 = new javax.swing.JLabel();
        infoLabel4 = new javax.swing.JLabel();
        infoLabel5 = new javax.swing.JLabel();
        selectionPanel = new javax.swing.JPanel();
        optionsPanel = new javax.swing.JPanel();
        encodRadioButton = new javax.swing.JRadioButton();
        metaRadioButton = new javax.swing.JRadioButton();
        chooseButton = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("More Good Foundation");
        setBackground(new java.awt.Color(255, 255, 255));
        getContentPane().setLayout(new java.awt.GridBagLayout());

        infoPanel.setLayout(new java.awt.GridLayout(5, 0, 0, 3));

        infoLabel1.setText("Thank you for choosing the More Good Foundation Encoder");
        infoPanel.add(infoLabel1);

        infoLabel2.setText("This software has two functions:");
        infoPanel.add(infoLabel2);

        infoLabel3.setText("    1. One to generate queries to be used by HandBrakeCLI");
        infoPanel.add(infoLabel3);

        infoLabel4.setText("    2. Create Video Meta Data files to help manage the videos");
        infoPanel.add(infoLabel4);

        infoLabel5.setText("Please select which feature you wish to implement.");
        infoPanel.add(infoLabel5);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        getContentPane().add(infoPanel, gridBagConstraints);

        selectionPanel.setLayout(new java.awt.GridBagLayout());

        optionsPanel.setLayout(new java.awt.GridBagLayout());

        choicesRadioButtonGroup.add(encodRadioButton);
        encodRadioButton.setSelected(true);
        encodRadioButton.setText("Encode Query Generator");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        optionsPanel.add(encodRadioButton, gridBagConstraints);

        choicesRadioButtonGroup.add(metaRadioButton);
        metaRadioButton.setText("Video Meta Data Generator");
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        optionsPanel.add(metaRadioButton, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 0);
        selectionPanel.add(optionsPanel, gridBagConstraints);

        chooseButton.setText("Choose");
        chooseButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                chooseButtonMouseClicked(evt);
            }
        });
        chooseButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                chooseButtonActionPerformed(evt);
            }
        });
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.insets = new java.awt.Insets(10, 0, 10, 0);
        selectionPanel.add(chooseButton, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.ipadx = 10;
        gridBagConstraints.ipady = 20;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
        getContentPane().add(selectionPanel, gridBagConstraints);

        pack();
    }// //GEN-END:initComponents

    private void chooseButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_chooseButtonMouseClicked
      JFrame selectedFrame = new JFrame();
      if (encodRadioButton.isSelected()) {
        selectedFrame = new EncodeFrame();
      } else if (metaRadioButton.isSelected()) {
        selectedFrame = new DescriptionFrame();
      }
      selectedFrame.setVisible(true);
      this.setVisible(false);
      this.dispose();
    }//GEN-LAST:event_chooseButtonMouseClicked

  private void chooseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chooseButtonActionPerformed
    JFrame selectedFrame = new JFrame();
      if (encodRadioButton.isSelected()) {
        selectedFrame = new EncodeFrame();
      } else if (metaRadioButton.isSelected()) {
        selectedFrame = new DescriptionFrame();
      }
      this.dispose();
      selectedFrame.setVisible(true);
  }//GEN-LAST:event_chooseButtonActionPerformed

  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    /** Set the Nimbus look and feel */
    //
        /** 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(StartFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(StartFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(StartFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(StartFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //

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

      public void run() {
        new StartFrame().setVisible(true);
      }
    });
  }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup choicesRadioButtonGroup;
    private javax.swing.JButton chooseButton;
    private javax.swing.JRadioButton encodRadioButton;
    private javax.swing.JLabel infoLabel1;
    private javax.swing.JLabel infoLabel2;
    private javax.swing.JLabel infoLabel3;
    private javax.swing.JLabel infoLabel4;
    private javax.swing.JLabel infoLabel5;
    private javax.swing.JPanel infoPanel;
    private javax.swing.JRadioButton metaRadioButton;
    private javax.swing.JPanel optionsPanel;
    private javax.swing.JPanel selectionPanel;
    // End of variables declaration//GEN-END:variables
}