Advertisement
ljukk

newFrame

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