Advertisement
Guest User

Untitled

a guest
Dec 21st, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.69 KB | None | 0 0
  1. public class NewJFrame extends javax.swing.JFrame {
  2.  
  3.     /** Creates new form NewJFrame */
  4.     public NewJFrame() {
  5.         initComponents();
  6.     }
  7.  
  8.     /** This method is called from within the constructor to
  9.      * initialize the form.
  10.      * WARNING: Do NOT modify this code. The content of this method is
  11.      * always regenerated by the Form Editor.
  12.      */
  13.     @SuppressWarnings("unchecked")
  14.     // <editor-fold defaultstate="collapsed" desc="Generated Code">
  15.     private void initComponents() {
  16.  
  17.         Begin = new javax.swing.JButton();
  18.  
  19.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  20.  
  21.         Begin.setText("Begin");
  22.         Begin.addActionListener(new java.awt.event.ActionListener() {
  23.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  24.                 BeginActionPerformed(evt);
  25.             }
  26.         });
  27.  
  28.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  29.         getContentPane().setLayout(layout);
  30.         layout.setHorizontalGroup(
  31.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  32.             .addGroup(layout.createSequentialGroup()
  33.                 .addContainerGap()
  34.                 .addComponent(Begin, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
  35.                 .addContainerGap())
  36.         );
  37.         layout.setVerticalGroup(
  38.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  39.             .addGroup(layout.createSequentialGroup()
  40.                 .addContainerGap()
  41.                 .addComponent(Begin, javax.swing.GroupLayout.DEFAULT_SIZE, 278, Short.MAX_VALUE)
  42.                 .addContainerGap())
  43.         );
  44.  
  45.         pack();
  46.     }// </editor-fold>
  47. PlaySound s = new PlaySound();
  48. private void BeginActionPerformed(java.awt.event.ActionEvent evt) {
  49. s.run();
  50. }
  51.  
  52.     /**
  53.      * @param args the command line arguments
  54.      */
  55.     public static void main(String args[]) {
  56.         /* Set the Nimbus look and feel */
  57.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  58.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  59.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  60.          */
  61.         try {
  62.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  63.                 if ("Nimbus".equals(info.getName())) {
  64.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  65.                     break;
  66.                 }
  67.             }
  68.         } catch (ClassNotFoundException ex) {
  69.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  70.         } catch (InstantiationException ex) {
  71.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  72.         } catch (IllegalAccessException ex) {
  73.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  74.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  75.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  76.         }
  77.         //</editor-fold>
  78.  
  79.         /* Create and display the form */
  80.         java.awt.EventQueue.invokeLater(new Runnable() {
  81.  
  82.             public void run() {
  83.                 new NewJFrame().setVisible(true);
  84.             }
  85.         });
  86.     }
  87.     // Variables declaration - do not modify
  88.     private javax.swing.JButton Begin;
  89.     // End of variables declaration
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement