Advertisement
NB52053

Nadui_GUI

Jul 22nd, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.42 KB | None | 0 0
  1. package guiBall;
  2.  
  3.  
  4. public class NewJFrame extends javax.swing.JFrame {
  5.  
  6.  
  7.     public NewJFrame() {
  8.         initComponents();
  9.     }
  10.  
  11.  
  12.     //@SuppressWarnings("unchecked")
  13.     private void initComponents() {
  14.  
  15.         //jPanel1 = new javax.swing.JPanel();
  16.         jInternalFrame1 = new javax.swing.JInternalFrame();
  17.         jPanel2 = new javax.swing.JPanel();
  18.         jButton1 = new javax.swing.JButton();
  19.         jTextField1 = new javax.swing.JTextField();
  20.         jButton2 = new javax.swing.JButton();
  21.         jInternalFrame2 = new javax.swing.JInternalFrame();
  22.         jPanel3 = new javax.swing.JPanel();
  23.         jPanel4 = new javax.swing.JPanel();
  24.         jTextField2 = new javax.swing.JTextField();
  25.         jTextField3 = new javax.swing.JTextField();
  26.  
  27.         jPanel1.setBackground(new java.awt.Color(246, 244, 150));
  28.         jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  29.  
  30.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  31.  
  32.         jPanel1.setLayout(jPanel1Layout);
  33.         jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 384, Short.MAX_VALUE));
  34.         jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 342, Short.MAX_VALUE));
  35.  
  36.         jInternalFrame1.setTitle("Scale Game");
  37.         jInternalFrame1.setVisible(true);
  38.  
  39.         javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
  40.  
  41.         jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
  42.  
  43.         jInternalFrame1Layout.setHorizontalGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 388, Short.MAX_VALUE));
  44.  
  45.         jInternalFrame1Layout.setVerticalGroup(
  46.                 jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  47.                         .addGap(0, 352, Short.MAX_VALUE)
  48.         );
  49.  
  50.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  51.  
  52.         jPanel2.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
  53.  
  54.         jButton1.setFont(new java.awt.Font("Comic Sans MS", 1, 15));
  55.         jButton1.setText("New game");
  56.  
  57.         jTextField1.setText("Chances : ");
  58.         jTextField1.addActionListener(new java.awt.event.ActionListener() {
  59.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  60.                 jTextField1ActionPerformed(evt);
  61.             }
  62.         });
  63.  
  64.         jButton2.setFont(new java.awt.Font("Comic Sans MS", 1, 15));
  65.         jButton2.setText("Exit");
  66.  
  67.         javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
  68.         jPanel2.setLayout(jPanel2Layout);
  69.         jPanel2Layout.setHorizontalGroup(
  70.                 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  71.                         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
  72.                                 .addContainerGap()
  73.                                 .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 116, javax.swing.GroupLayout.PREFERRED_SIZE)
  74.                                 .addGap(35, 35, 35)
  75.                                 .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
  76.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
  77.                                 .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)
  78.                                 .addContainerGap())
  79.         );
  80.         jPanel2Layout.setVerticalGroup(
  81.                 jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  82.                         .addGroup(jPanel2Layout.createSequentialGroup()
  83.                                 .addContainerGap()
  84.                                 .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  85.                                         .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  86.                                                 .addComponent(jButton1)
  87.                                                 .addComponent(jButton2))
  88.                                         .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  89.                                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  90.         );
  91.  
  92.         jInternalFrame2.setBackground(new java.awt.Color(246, 210, 242));
  93.         jInternalFrame2.setTitle("Scale game");
  94.         jInternalFrame2.setFont(new java.awt.Font("Impact", 1, 15)); // NOI18N
  95.         jInternalFrame2.setVisible(true);
  96.  
  97.         jPanel3.setBackground(new java.awt.Color(191, 69, 19));
  98.         jPanel3.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.LOWERED));
  99.  
  100.         javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
  101.         jPanel3.setLayout(jPanel3Layout);
  102.         jPanel3Layout.setHorizontalGroup(
  103.                 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104.                         .addGap(0, 0, Short.MAX_VALUE)
  105.         );
  106.         jPanel3Layout.setVerticalGroup(
  107.                 jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  108.                         .addGap(0, 361, Short.MAX_VALUE)
  109.         );
  110.  
  111.         jPanel4.setBackground(new java.awt.Color(220, 14, 24));
  112.         jPanel4.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
  113.  
  114.         jTextField2.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
  115.         jTextField2.setText("Highscore :");
  116.         jTextField2.addActionListener(new java.awt.event.ActionListener() {
  117.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  118.                 jTextField2ActionPerformed(evt);
  119.             }
  120.         });
  121.  
  122.         jTextField3.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
  123.         jTextField3.setText("Score : ");
  124.  
  125.         javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
  126.         jPanel4.setLayout(jPanel4Layout);
  127.         jPanel4Layout.setHorizontalGroup(
  128.                 jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  129.                         .addGroup(jPanel4Layout.createSequentialGroup()
  130.                                 .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE)
  131.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  132.                                 .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, 170, javax.swing.GroupLayout.PREFERRED_SIZE))
  133.         );
  134.         jPanel4Layout.setVerticalGroup(
  135.                 jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  136.                         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
  137.                                 .addGap(0, 0, Short.MAX_VALUE)
  138.                                 .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  139.                                         .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  140.                                         .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  141.         );
  142.  
  143.         javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContentPane());
  144.  
  145.         jInternalFrame2.getContentPane().setLayout(jInternalFrame2Layout);
  146.         jInternalFrame2Layout.setHorizontalGroup(
  147.                 jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  148.                         .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  149.                         .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  150.         );
  151.         jInternalFrame2Layout.setVerticalGroup(
  152.                 jInternalFrame2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  153.                         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame2Layout.createSequentialGroup()
  154.                                 .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  155.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  156.                                 .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  157.         );
  158.  
  159.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  160.         getContentPane().setLayout(layout);
  161.         layout.setHorizontalGroup(
  162.                 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  163.                         .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  164.                         .addComponent(jInternalFrame2)
  165.         );
  166.         layout.setVerticalGroup(
  167.                 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  168.                         .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  169.                                 .addGap(0, 0, 0)
  170.                                 .addComponent(jInternalFrame2)
  171.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  172.                                 .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  173.         );
  174.  
  175.         pack();
  176.     }
  177.  
  178.     private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
  179.         // TODO add your handling code here:
  180.     }
  181.  
  182.     private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
  183.         // TODO add your handling code here:
  184.     }
  185.  
  186.     public static void main(String args[]) {
  187.  
  188.        /* try {
  189.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  190.                 if ("Nimbus".equals(info.getName())) {
  191.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  192.                     break;
  193.                 }
  194.             }
  195.         } catch (ClassNotFoundException ex) {
  196.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  197.         } catch (InstantiationException ex) {
  198.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  199.         } catch (IllegalAccessException ex) {
  200.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  201.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  202.             java.util.logging.Logger.getLogger(NewJFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  203.         }*/
  204.  
  205.         java.awt.EventQueue.invokeLater(new Runnable() {
  206.  
  207.             public void run() {
  208.                 new NewJFrame().setVisible(true);
  209.             }
  210.         });
  211.     }
  212.  
  213.     private javax.swing.JButton jButton1;
  214.     private javax.swing.JButton jButton2;
  215.     private javax.swing.JInternalFrame jInternalFrame1;
  216.     private javax.swing.JInternalFrame jInternalFrame2;
  217.     private javax.swing.JPanel jPanel1;
  218.     private javax.swing.JPanel jPanel2;
  219.     private javax.swing.JPanel jPanel3;
  220.     private javax.swing.JPanel jPanel4;
  221.     private javax.swing.JTextField jTextField1;
  222.     private javax.swing.JTextField jTextField2;
  223.     private javax.swing.JTextField jTextField3;
  224.  
  225. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement