content: /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package havayolubilgisistemi;
  
  import java.awt.Color;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import javax.swing.table.DefaultTableModel;
  
  /**
   *
   * @author AsusTuf
   */
  public class PersonelBilgileri extends javax.swing.JFrame {
  
      private String adi;
  
      public PersonelBilgileri() {
          initComponents();
          Color backgroundColor = new Color(197, 255, 248);
          getContentPane().setBackground(backgroundColor);
  
          SorButton.setEnabled(false);
          AdiField.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(ActionEvent e) {
                  adi = AdiField.getText().trim();
                  if (!adi.equals("") && !adi.isEmpty()) {
                      SorButton.setEnabled(true);
                  }
              }
          });
  
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      @SuppressWarnings("unchecked")
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jPanel1 = new javax.swing.JPanel();
          jLabel1 = new javax.swing.JLabel();
          AdiField = new javax.swing.JTextField();
          SorButton = new javax.swing.JButton();
          jPanel2 = new javax.swing.JPanel();
          jScrollPane1 = new javax.swing.JScrollPane();
          jTable1 = new javax.swing.JTable();
          GeriButton = new javax.swing.JButton();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
          setResizable(false);
  
          jPanel1.setBackground(new java.awt.Color(150, 239, 255));
          jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  
          jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
          jLabel1.setText("Adınızı giriniz");
  
          AdiField.setText(" ");
          AdiField.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  AdiFieldActionPerformed(evt);
              }
          });
  
          SorButton.setBackground(new java.awt.Color(95, 189, 255));
          SorButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
          SorButton.setText("Sorgula");
          SorButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  SorButtonActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
          jPanel1.setLayout(jPanel1Layout);
          jPanel1Layout.setHorizontalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(jPanel1Layout.createSequentialGroup()
                  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                      .addComponent(AdiField, javax.swing.GroupLayout.PREFERRED_SIZE, 196, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                          .addGroup(jPanel1Layout.createSequentialGroup()
                              .addGap(67, 67, 67)
                              .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 176, javax.swing.GroupLayout.PREFERRED_SIZE))
                          .addGroup(jPanel1Layout.createSequentialGroup()
                              .addGap(100, 100, 100)
                              .addComponent(SorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))))
                  .addContainerGap(40, Short.MAX_VALUE))
          );
          jPanel1Layout.setVerticalGroup(
              jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(jPanel1Layout.createSequentialGroup()
                  .addGap(69, 69, 69)
                  .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(30, 30, 30)
                  .addComponent(AdiField, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(173, 173, 173)
                  .addComponent(SorButton, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(31, Short.MAX_VALUE))
          );
  
          jPanel2.setBackground(new java.awt.Color(255, 255, 255));
          jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
  
          jTable1.setModel(new javax.swing.table.DefaultTableModel(
              new Object [][] {
                  {null, null, null, null},
                  {null, null, null, null},
                  {null, null, null, null},
                  {null, null, null, null}
              },
              new String [] {
                  "Title 1", "Title 2", "Title 3", "Title 4"
              }
          ));
          jScrollPane1.setViewportView(jTable1);
  
          javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
          jPanel2.setLayout(jPanel2Layout);
          jPanel2Layout.setHorizontalGroup(
              jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 853, Short.MAX_VALUE)
          );
          jPanel2Layout.setVerticalGroup(
              jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 592, Short.MAX_VALUE)
          );
  
          GeriButton.setBackground(new java.awt.Color(95, 189, 255));
          GeriButton.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
          GeriButton.setText("Geri");
          GeriButton.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  GeriButtonActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addGroup(layout.createSequentialGroup()
                          .addContainerGap()
                          .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createSequentialGroup()
                          .addGap(80, 80, 80)
                          .addComponent(GeriButton, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addGap(33, 33, 33)
                  .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addContainerGap(95, Short.MAX_VALUE))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGap(52, 52, 52)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                      .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(GeriButton, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addContainerGap(74, Short.MAX_VALUE))
          );
  
          pack();
      }// </editor-fold>//GEN-END:initComponents
  
      private void SorButtonActionPerformed(java.awt.event.ActionEvent evt) {
          // Sorgula 
          Personel pre = null;
          for (User person : HavaYolu.PersonelList) {
              if (person instanceof Personel && person.getName().equals(adi)) {
                  pre = (Personel) person;
                  System.out.println(person.getName());
                  break;
              } else {
                  continue;
              }
          }
          if(pre!=null){
          DefaultTableModel tableModel = new DefaultTableModel();
          tableModel.addColumn("Sirket Adi");
          tableModel.addColumn("no");
          tableModel.addColumn("KM");
          tableModel.addColumn("Tarih");
          tableModel.addColumn("saat");
          tableModel.addColumn("nerden");
          tableModel.addColumn("nereye");
          tableModel.addColumn("Sure");
          tableModel.addColumn("ucak Adi");
  
          for (Ucus ucus : pre.Ucuslar) {
              tableModel.addRow(new Object[]{ucus.ucak.sirketadi, ucus.no, ucus.KM, ucus.formattedDate, ucus.saat, ucus.nerden, ucus.nereye, ucus.sure, ucus.ucak.name});
          }
          jTable1.setModel(tableModel); 
          }
      }
      private void AdiFieldActionPerformed(java.awt.event.ActionEvent evt) {
          adi = AdiField.getText().trim();
      }
      // Geri Buttonu
      private void GeriButtonActionPerformed(java.awt.event.ActionEvent evt) {
          Baslangis basla = new Baslangis();
          basla.setVisible(true);
          setVisible(false);
      }
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(PersonelBilgileri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(PersonelBilgileri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(PersonelBilgileri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(PersonelBilgileri.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //</editor-fold>
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new PersonelBilgileri().setVisible(true);
              }
          });
      }
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JTextField AdiField;
      private javax.swing.JButton GeriButton;
      private javax.swing.JButton SorButton;
      private javax.swing.JLabel jLabel1;
      private javax.swing.JPanel jPanel1;
      private javax.swing.JPanel jPanel2;
      private javax.swing.JScrollPane jScrollPane1;
      private javax.swing.JTable jTable1;
      // End of variables declaration//GEN-END:variables
  }
  