ljukk

gula-frame

May 23rd, 2017
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.59 KB | None | 0 0
  1.  @author sused
  2.  */
  3. public class BowlingovaDraha extends javax.swing.JFrame {
  4.    
  5.     Gula g;
  6.  
  7.     /**
  8.      * Creates new form Gula
  9.      */
  10.     public BowlingovaDraha() {
  11.         initComponents();
  12.         g = new Gula(175, 100,this);
  13.         this.add(g);
  14.     }
  15.  
  16.     /**
  17.      * This method is called from within the constructor to initialize the form.
  18.      * WARNING: Do NOT modify this code. The content of this method is always
  19.      * regenerated by the Form Editor.
  20.      */
  21.     @SuppressWarnings("unchecked")
  22.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  23.     private void initComponents() {
  24.  
  25.         jButton1 = new javax.swing.JButton();
  26.         jButton2 = new javax.swing.JButton();
  27.         jButton3 = new javax.swing.JButton();
  28.  
  29.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  30.  
  31.         jButton1.setText("<<");
  32.         jButton1.addActionListener(new java.awt.event.ActionListener() {
  33.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  34.                 jButton1ActionPerformed(evt);
  35.             }
  36.         });
  37.  
  38.         jButton2.setText(">>");
  39.         jButton2.addActionListener(new java.awt.event.ActionListener() {
  40.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  41.                 jButton2ActionPerformed(evt);
  42.             }
  43.         });
  44.  
  45.         jButton3.setText("Zmena smeru");
  46.         jButton3.addActionListener(new java.awt.event.ActionListener() {
  47.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  48.                 jButton3ActionPerformed(evt);
  49.             }
  50.         });
  51.  
  52.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  53.         getContentPane().setLayout(layout);
  54.         layout.setHorizontalGroup(
  55.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  56.             .addGroup(layout.createSequentialGroup()
  57.                 .addComponent(jButton1)
  58.                 .addGap(108, 108, 108)
  59.                 .addComponent(jButton3)
  60.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 87, Short.MAX_VALUE)
  61.                 .addComponent(jButton2)
  62.                 .addContainerGap())
  63.         );
  64.         layout.setVerticalGroup(
  65.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  66.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  67.                 .addContainerGap(266, Short.MAX_VALUE)
  68.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  69.                     .addComponent(jButton1)
  70.                     .addComponent(jButton2)
  71.                     .addComponent(jButton3))
  72.                 .addContainerGap())
  73.         );
  74.  
  75.         pack();
  76.     }// </editor-fold>                        
  77.  
  78.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  79.         // TODO add your handling code here:
  80.         g.dolava();
  81.     }                                        
  82.  
  83.     private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  84.         // TODO add your handling code here:
  85.         g.doprava();
  86.     }                                        
  87.  
  88.     private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                        
  89.         // TODO add your handling code here:
  90.         g.zmenaSmeru();
  91.     }                                        
  92.  
  93.     /**
  94.      * @param args the command line arguments
  95.      */
  96.     public static void main(String args[]) {
  97.         /* Set the Nimbus look and feel */
  98.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  99.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  100.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  101.          */
  102.         try {
  103.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  104.                 if ("Nimbus".equals(info.getName())) {
  105.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  106.                     break;
  107.                 }
  108.             }
  109.         } catch (ClassNotFoundException ex) {
  110.             java.util.logging.Logger.getLogger(BowlingovaDraha.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  111.         } catch (InstantiationException ex) {
  112.             java.util.logging.Logger.getLogger(BowlingovaDraha.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  113.         } catch (IllegalAccessException ex) {
  114.             java.util.logging.Logger.getLogger(BowlingovaDraha.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  115.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  116.             java.util.logging.Logger.getLogger(BowlingovaDraha.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  117.         }
  118.         //</editor-fold>
  119.         //</editor-fold>
  120.         //</editor-fold>
  121.         //</editor-fold>
  122.  
  123.         /* Create and display the form */
  124.         java.awt.EventQueue.invokeLater(new Runnable() {
  125.             public void run() {
  126.                 new BowlingovaDraha().setVisible(true);
  127.             }
  128.         });
  129.     }
  130.  
  131.     // Variables declaration - do not modify                    
  132.     private javax.swing.JButton jButton1;
  133.     private javax.swing.JButton jButton2;
  134.     private javax.swing.JButton jButton3;
  135.     // End of variables declaration
Add Comment
Please, Sign In to add comment