Advertisement
Guest User

Untitled

a guest
Jan 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.53 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package kjnkfdsf;
  7.  
  8. import java.sql.Connection;
  9.  
  10. /**
  11.  *
  12.  * @author michalus21
  13.  */
  14. public class GUI extends javax.swing.JFrame {
  15.  
  16.     Konekcja con = new Konekcja();
  17.     /**
  18.      * Creates new form GUI
  19.      */
  20.     public GUI() {
  21.         initComponents();
  22.     }
  23.  
  24.     /**
  25.      * This method is called from within the constructor to initialize the form.
  26.      * WARNING: Do NOT modify this code. The content of this method is always
  27.      * regenerated by the Form Editor.
  28.      */
  29.     @SuppressWarnings("unchecked")
  30.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  31.     private void initComponents() {
  32.  
  33.         jLabel1 = new javax.swing.JLabel();
  34.         loginField = new javax.swing.JTextField();
  35.         addButton = new javax.swing.JButton();
  36.         pobierzButton = new javax.swing.JButton();
  37.         jScrollPane1 = new javax.swing.JScrollPane();
  38.         textWyniki = new javax.swing.JTextArea();
  39.         jButtonCreateTable = new javax.swing.JButton();
  40.  
  41.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  42.  
  43.         jLabel1.setText("Login");
  44.  
  45.         loginField.addActionListener(new java.awt.event.ActionListener() {
  46.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  47.                 loginFieldActionPerformed(evt);
  48.             }
  49.         });
  50.  
  51.         addButton.setText("Dodaj");
  52.         addButton.addActionListener(new java.awt.event.ActionListener() {
  53.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  54.                 addButtonActionPerformed(evt);
  55.             }
  56.         });
  57.  
  58.         pobierzButton.setText("Pobierz");
  59.         pobierzButton.addActionListener(new java.awt.event.ActionListener() {
  60.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  61.                 pobierzButtonActionPerformed(evt);
  62.             }
  63.         });
  64.  
  65.         textWyniki.setColumns(20);
  66.         textWyniki.setRows(5);
  67.         jScrollPane1.setViewportView(textWyniki);
  68.  
  69.         jButtonCreateTable.setText("Stworz tabele");
  70.         jButtonCreateTable.addActionListener(new java.awt.event.ActionListener() {
  71.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  72.                 jButtonCreateTableActionPerformed(evt);
  73.             }
  74.         });
  75.  
  76.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  77.         getContentPane().setLayout(layout);
  78.         layout.setHorizontalGroup(
  79.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  80.             .addGroup(layout.createSequentialGroup()
  81.                 .addGap(41, 41, 41)
  82.                 .addComponent(jLabel1)
  83.                 .addGap(181, 181, 181)
  84.                 .addComponent(addButton)
  85.                 .addGap(18, 18, 18)
  86.                 .addComponent(jButtonCreateTable)
  87.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  88.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
  89.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  90.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  91.                     .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  92.                     .addComponent(pobierzButton))
  93.                 .addGap(78, 78, 78))
  94.             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  95.                 .addGroup(layout.createSequentialGroup()
  96.                     .addGap(39, 39, 39)
  97.                     .addComponent(loginField, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
  98.                     .addContainerGap(346, Short.MAX_VALUE)))
  99.         );
  100.         layout.setVerticalGroup(
  101.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  102.             .addGroup(layout.createSequentialGroup()
  103.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  104.                     .addGroup(layout.createSequentialGroup()
  105.                         .addGap(41, 41, 41)
  106.                         .addComponent(jLabel1)
  107.                         .addGap(18, 18, 18)
  108.                         .addComponent(addButton))
  109.                     .addGroup(layout.createSequentialGroup()
  110.                         .addGap(91, 91, 91)
  111.                         .addComponent(jButtonCreateTable)))
  112.                 .addGap(9, 9, 9)
  113.                 .addComponent(pobierzButton)
  114.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  115.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  116.                 .addContainerGap(40, Short.MAX_VALUE))
  117.             .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  118.                 .addGroup(layout.createSequentialGroup()
  119.                     .addGap(80, 80, 80)
  120.                     .addComponent(loginField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  121.                     .addContainerGap(193, Short.MAX_VALUE)))
  122.         );
  123.  
  124.         pack();
  125.     }// </editor-fold>                        
  126.  
  127.     private void loginFieldActionPerformed(java.awt.event.ActionEvent evt) {                                          
  128.         // TODO add your handling code here:
  129.     }                                          
  130.  
  131.     private void addButtonActionPerformed(java.awt.event.ActionEvent evt) {                                          
  132.         con.addRecord(loginField.getText());
  133.     }                                        
  134.  
  135.     private void jButtonCreateTableActionPerformed(java.awt.event.ActionEvent evt) {                                                  
  136.         con.createTable();
  137.     }                                                  
  138.  
  139.     private void pobierzButtonActionPerformed(java.awt.event.ActionEvent evt) {                                              
  140.         con.selectAll();
  141.     }                                            
  142.  
  143.     /**
  144.      * @param args the command line arguments
  145.      */
  146.     public static void main(String args[]) {
  147.         /* Set the Nimbus look and feel */
  148.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  149.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  150.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  151.          */
  152.         try {
  153.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  154.                 if ("Nimbus".equals(info.getName())) {
  155.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  156.                     break;
  157.                 }
  158.             }
  159.         } catch (ClassNotFoundException ex) {
  160.             java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  161.         } catch (InstantiationException ex) {
  162.             java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  163.         } catch (IllegalAccessException ex) {
  164.             java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  165.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  166.             java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  167.         }
  168.         //</editor-fold>
  169.  
  170.         /* Create and display the form */
  171.         java.awt.EventQueue.invokeLater(new Runnable() {
  172.             public void run() {
  173.                 new GUI().setVisible(true);
  174.             }
  175.         });
  176.     }
  177.  
  178.     // Variables declaration - do not modify                    
  179.     private javax.swing.JButton addButton;
  180.     private javax.swing.JButton jButtonCreateTable;
  181.     private javax.swing.JLabel jLabel1;
  182.     private javax.swing.JScrollPane jScrollPane1;
  183.     private javax.swing.JTextField loginField;
  184.     private javax.swing.JButton pobierzButton;
  185.     private javax.swing.JTextArea textWyniki;
  186.     // End of variables declaration                  
  187. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement