Advertisement
xlrnxnlx

AAPMainWindow

Jun 13th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 36.81 KB | None | 0 0
  1. package aap.view;
  2.  
  3. import java.awt.Color;
  4. import java.util.Vector;
  5. import javax.swing.JButton;
  6. import javax.swing.JComboBox;
  7. import javax.swing.JTable;
  8. import javax.swing.JTextField;
  9. import javax.swing.border.LineBorder;
  10. import javax.swing.table.DefaultTableModel;
  11.  
  12. public class MainWindow extends javax.swing.JFrame {
  13.  
  14.     public MainWindow() {
  15.         initComponents();
  16.  
  17.         Appearance appearance = new Appearance();
  18.         appearance.tryUseSystemLookAndFeel(this);
  19.  
  20.         pilotCombo = new JComboBox();
  21.         airplaneCombo = new JComboBox();
  22.  
  23.         pilotCombo.setBounds(680, 406, 180, 40);
  24.         airplaneCombo.setBounds(880, 406, 180, 40);
  25.         contentPanel.add(pilotCombo);
  26.         contentPanel.add(airplaneCombo);
  27.  
  28.         this.setLocationRelativeTo(null);
  29.         isNewMode(false);
  30.     }
  31.  
  32.     private JComboBox pilotCombo, airplaneCombo;
  33.  
  34.     public void popTable(Vector<Vector> tBody) {
  35.         Vector<String> tHead = new Vector();
  36.         tHead.add("Piloto");
  37.         tHead.add("Avião");
  38.         tHead.add("Data");
  39.         tHead.add("Destino");
  40.         tHead.add("Passageiros");
  41.  
  42.         DefaultTableModel model = new DefaultTableModel(tBody, tHead);
  43.         this.table.setModel(model);
  44.     }
  45.    
  46.     public void popComboBox(Vector<Vector> list, int combo) {
  47.         if( combo == 1) {
  48.             if(pilotCombo.getItemCount() > 0)
  49.                 pilotCombo.removeAllItems();
  50.             Vector current;
  51.             for (int i = 0; i < list.size(); i++) {
  52.                 current = new Vector();
  53.                 current = list.get(i);
  54.                 pilotCombo.addItem(current.get(0));
  55.             }
  56.         } else if (combo == 2){
  57.             if (airplaneCombo.getItemCount() > 0)
  58.                 airplaneCombo.removeAllItems();
  59.             Vector current;
  60.             for (int i = 0; i < list.size(); i++) {
  61.                 current = new Vector();
  62.                 current = list.get(i);
  63.                 airplaneCombo.addItem(current.get(0));
  64.             }
  65.         }
  66.     }
  67.    
  68.    
  69.     public void tfNormalState() {
  70.         tfDate.setText(tfDate.getName());
  71.         tfLocation.setText(tfLocation.getName());
  72.         tfPassengers.setText(tfPassengers.getName());
  73.     }
  74.  
  75.     public void isNewMode(boolean state) {
  76.         tfLocation.setVisible(state);
  77.         tfPassengers.setVisible(state);
  78.         tfDate.setVisible(state);
  79.         pilotCombo.setVisible(state);
  80.         airplaneCombo.setVisible(state);
  81.         lbPilotCombo.setVisible(state);
  82.         lbPlaneCombo.setVisible(state);
  83.         btInsert.setVisible(state);
  84.         if (state) {
  85.             btAirplane.setEnabled(false);
  86.             btAirplaneCategory.setEnabled(false);
  87.             btNew.setEnabled(false);
  88.             btPilot.setEnabled(false);
  89.             btPilotCategory.setEnabled(false);
  90.             table.setEnabled(false);
  91.         } else {
  92.             btAirplane.setEnabled(true);
  93.             btAirplaneCategory.setEnabled(true);
  94.             btNew.setEnabled(true);
  95.             btPilot.setEnabled(true);
  96.             btPilotCategory.setEnabled(true);
  97.             table.setEnabled(true);
  98.         }
  99.         btAirplane.setEnabled(false);
  100.     }
  101.  
  102.     // <editor-fold defaultstate="collapsed" desc=". . . . . ">
  103.     public JComboBox getPilotCombo() {
  104.         return pilotCombo;
  105.     }
  106.  
  107.     public void setPilotCombo(JComboBox pilotCombo) {
  108.         this.pilotCombo = pilotCombo;
  109.     }
  110.  
  111.     public JComboBox getAirplaneCombo() {
  112.         return airplaneCombo;
  113.     }
  114.  
  115.     public void setAirplaneCombo(JComboBox airplaneCombo) {
  116.         this.airplaneCombo = airplaneCombo;
  117.     }
  118.  
  119.     public JButton getBtAirplane() {
  120.         return btAirplane;
  121.     }
  122.  
  123.     public void setBtAirplane(JButton btAirplane) {
  124.         this.btAirplane = btAirplane;
  125.     }
  126.  
  127.     public JButton getBtAirplaneCategory() {
  128.         return btAirplaneCategory;
  129.     }
  130.  
  131.     public void setBtAirplaneCategory(JButton btAirplaneCategory) {
  132.         this.btAirplaneCategory = btAirplaneCategory;
  133.     }
  134.  
  135.     public JButton getBtInsert() {
  136.         return btInsert;
  137.     }
  138.  
  139.     public void setBtInsert(JButton btInsert) {
  140.         this.btInsert = btInsert;
  141.     }
  142.  
  143.     public JButton getBtCancel() {
  144.         return btCancel;
  145.     }
  146.  
  147.     public void setBtCancel(JButton btCancel) {
  148.         this.btCancel = btCancel;
  149.     }
  150.  
  151.     public JButton getBtNew() {
  152.         return btNew;
  153.     }
  154.  
  155.     public void setBtNew(JButton btNew) {
  156.         this.btNew = btNew;
  157.     }
  158.  
  159.     public JButton getBtPilot() {
  160.         return btPilot;
  161.     }
  162.  
  163.     public void setBtPilot(JButton btPilot) {
  164.         this.btPilot = btPilot;
  165.     }
  166.  
  167.     public JButton getBtPilotCategory() {
  168.         return btPilotCategory;
  169.     }
  170.  
  171.     public void setBtPilotCategory(JButton btPilotCategory) {
  172.         this.btPilotCategory = btPilotCategory;
  173.     }
  174.  
  175.     public JTable getTable() {
  176.         return table;
  177.     }
  178.  
  179.     public void setTable(JTable table) {
  180.         this.table = table;
  181.     }
  182.  
  183.     public JTextField getTfLocation() {
  184.         return tfLocation;
  185.     }
  186.  
  187.     public void setTfLocation(JTextField tfLocation) {
  188.         this.tfLocation = tfLocation;
  189.     }
  190.  
  191.     public JTextField getTfPassengers() {
  192.         return tfPassengers;
  193.     }
  194.  
  195.     public void setTfPassengers(JTextField tfPassengers) {
  196.         this.tfPassengers = tfPassengers;
  197.     }
  198.  
  199.     public JTextField getTfDate() {
  200.         return tfDate;
  201.     }
  202.  
  203.     public void setTfDate(JTextField tfDate) {
  204.         this.tfDate = tfDate;
  205.     }
  206.  
  207.     @SuppressWarnings("unchecked")
  208.     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
  209.     private void initComponents() {
  210.  
  211.         rootPanel = new javax.swing.JPanel();
  212.         contentPanel = new javax.swing.JPanel();
  213.         lbRegisteredTravels = new javax.swing.JLabel();
  214.         jScrollPane1 = new javax.swing.JScrollPane();
  215.         table = new javax.swing.JTable();
  216.         lbNewTravels = new javax.swing.JLabel();
  217.         btNew = new javax.swing.JButton();
  218.         btCancel = new javax.swing.JButton();
  219.         tfPassengers = new javax.swing.JTextField();
  220.         jSeparator4 = new javax.swing.JSeparator();
  221.         tfLocation = new javax.swing.JTextField();
  222.         lbPilotCombo = new javax.swing.JLabel();
  223.         lbPlaneCombo = new javax.swing.JLabel();
  224.         btInsert = new javax.swing.JButton();
  225.         tfDate = new javax.swing.JTextField();
  226.         topPanel = new javax.swing.JPanel();
  227.         btAirplaneCategory = new javax.swing.JButton();
  228.         btPilot = new javax.swing.JButton();
  229.         jLabel3 = new javax.swing.JLabel();
  230.         btAirplane = new javax.swing.JButton();
  231.         btPilotCategory = new javax.swing.JButton();
  232.  
  233.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  234.         setResizable(false);
  235.  
  236.         rootPanel.setBackground(new java.awt.Color(102, 102, 102));
  237.  
  238.         contentPanel.setBackground(new java.awt.Color(255, 255, 255));
  239.  
  240.         lbRegisteredTravels.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
  241.         lbRegisteredTravels.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/flag.png"))); // NOI18N
  242.         lbRegisteredTravels.setText("Viagens registradas");
  243.  
  244.         table.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
  245.         table.setModel(new javax.swing.table.DefaultTableModel(
  246.             new Object [][] {
  247.                 {null, null, null, null, null},
  248.                 {null, null, null, null, null},
  249.                 {null, null, null, null, null},
  250.                 {null, null, null, null, null}
  251.             },
  252.             new String [] {
  253.                 "Piloto", "Avião", "Data", "Destino", "Passageiros "
  254.             }
  255.         ));
  256.         table.setGridColor(new java.awt.Color(204, 204, 204));
  257.         table.setRowHeight(28);
  258.         table.setSelectionBackground(new java.awt.Color(204, 204, 204));
  259.         table.setSurrendersFocusOnKeystroke(true);
  260.         jScrollPane1.setViewportView(table);
  261.  
  262.         lbNewTravels.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
  263.         lbNewTravels.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/plus.png"))); // NOI18N
  264.         lbNewTravels.setText("Controle de Viagens");
  265.  
  266.         btNew.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  267.         btNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
  268.         btNew.setText("Nova");
  269.         btNew.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  270.         btNew.setContentAreaFilled(false);
  271.         btNew.setFocusable(false);
  272.         btNew.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
  273.         btNew.addMouseListener(new java.awt.event.MouseAdapter() {
  274.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  275.                 btNewMouseEntered(evt);
  276.             }
  277.             public void mouseExited(java.awt.event.MouseEvent evt) {
  278.                 btNewMouseExited(evt);
  279.             }
  280.         });
  281.  
  282.         btCancel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  283.         btCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
  284.         btCancel.setText("Cancelamento");
  285.         btCancel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  286.         btCancel.setContentAreaFilled(false);
  287.         btCancel.setFocusable(false);
  288.         btCancel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
  289.         btCancel.addMouseListener(new java.awt.event.MouseAdapter() {
  290.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  291.                 btCancelMouseEntered(evt);
  292.             }
  293.             public void mouseExited(java.awt.event.MouseEvent evt) {
  294.                 btCancelMouseExited(evt);
  295.             }
  296.         });
  297.  
  298.         tfPassengers.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
  299.         tfPassengers.setForeground(new java.awt.Color(102, 102, 102));
  300.         tfPassengers.setText("Passageiros");
  301.         tfPassengers.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
  302.         tfPassengers.setName("Passageiros"); // NOI18N
  303.         tfPassengers.addFocusListener(new java.awt.event.FocusAdapter() {
  304.             public void focusGained(java.awt.event.FocusEvent evt) {
  305.                 tfPassengersFocusGained(evt);
  306.             }
  307.             public void focusLost(java.awt.event.FocusEvent evt) {
  308.                 tfPassengersFocusLost(evt);
  309.             }
  310.         });
  311.  
  312.         jSeparator4.setForeground(new java.awt.Color(240, 240, 240));
  313.  
  314.         tfLocation.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
  315.         tfLocation.setForeground(new java.awt.Color(102, 102, 102));
  316.         tfLocation.setText("Destino");
  317.         tfLocation.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
  318.         tfLocation.setName("Destino"); // NOI18N
  319.         tfLocation.addFocusListener(new java.awt.event.FocusAdapter() {
  320.             public void focusGained(java.awt.event.FocusEvent evt) {
  321.                 tfLocationFocusGained(evt);
  322.             }
  323.             public void focusLost(java.awt.event.FocusEvent evt) {
  324.                 tfLocationFocusLost(evt);
  325.             }
  326.         });
  327.  
  328.         lbPilotCombo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  329.         lbPilotCombo.setForeground(new java.awt.Color(153, 153, 153));
  330.         lbPilotCombo.setText("Pilotos disponíveis");
  331.  
  332.         lbPlaneCombo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  333.         lbPlaneCombo.setForeground(new java.awt.Color(153, 153, 153));
  334.         lbPlaneCombo.setText("Aviões disponíveis");
  335.  
  336.         btInsert.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  337.         btInsert.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
  338.         btInsert.setText("Inserir");
  339.         btInsert.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  340.         btInsert.setContentAreaFilled(false);
  341.         btInsert.setFocusable(false);
  342.         btInsert.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
  343.         btInsert.addMouseListener(new java.awt.event.MouseAdapter() {
  344.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  345.                 btInsertMouseEntered(evt);
  346.             }
  347.             public void mouseExited(java.awt.event.MouseEvent evt) {
  348.                 btInsertMouseExited(evt);
  349.             }
  350.         });
  351.  
  352.         tfDate.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
  353.         tfDate.setForeground(new java.awt.Color(102, 102, 102));
  354.         tfDate.setText("Data");
  355.         tfDate.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
  356.         tfDate.setName("Data"); // NOI18N
  357.         tfDate.addFocusListener(new java.awt.event.FocusAdapter() {
  358.             public void focusGained(java.awt.event.FocusEvent evt) {
  359.                 tfDateFocusGained(evt);
  360.             }
  361.             public void focusLost(java.awt.event.FocusEvent evt) {
  362.                 tfDateFocusLost(evt);
  363.             }
  364.         });
  365.  
  366.         javax.swing.GroupLayout contentPanelLayout = new javax.swing.GroupLayout(contentPanel);
  367.         contentPanel.setLayout(contentPanelLayout);
  368.         contentPanelLayout.setHorizontalGroup(
  369.             contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  370.             .addGroup(contentPanelLayout.createSequentialGroup()
  371.                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  372.                     .addGroup(contentPanelLayout.createSequentialGroup()
  373.                         .addGap(29, 29, 29)
  374.                         .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  375.                             .addComponent(lbRegisteredTravels, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
  376.                             .addGroup(contentPanelLayout.createSequentialGroup()
  377.                                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  378.                                     .addComponent(btCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  379.                                     .addComponent(btNew, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  380.                                     .addComponent(lbNewTravels, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  381.                                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  382.                                     .addGroup(contentPanelLayout.createSequentialGroup()
  383.                                         .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  384.                                             .addGroup(contentPanelLayout.createSequentialGroup()
  385.                                                 .addGap(523, 523, 523)
  386.                                                 .addComponent(lbPilotCombo)
  387.                                                 .addGap(78, 78, 78)
  388.                                                 .addComponent(lbPlaneCombo))
  389.                                             .addGroup(contentPanelLayout.createSequentialGroup()
  390.                                                 .addGap(12, 12, 12)
  391.                                                 .addComponent(tfPassengers, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
  392.                                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  393.                                                 .addComponent(tfLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
  394.                                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  395.                                                 .addComponent(tfDate, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)))
  396.                                         .addGap(0, 194, Short.MAX_VALUE))
  397.                                     .addGroup(contentPanelLayout.createSequentialGroup()
  398.                                         .addGap(18, 18, 18)
  399.                                         .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  400.                                             .addGroup(contentPanelLayout.createSequentialGroup()
  401.                                                 .addGap(0, 0, Short.MAX_VALUE)
  402.                                                 .addComponent(btInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
  403.                                             .addComponent(jSeparator4)))))))
  404.                     .addGroup(contentPanelLayout.createSequentialGroup()
  405.                         .addContainerGap()
  406.                         .addComponent(jScrollPane1)))
  407.                 .addContainerGap())
  408.         );
  409.         contentPanelLayout.setVerticalGroup(
  410.             contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  411.             .addGroup(contentPanelLayout.createSequentialGroup()
  412.                 .addContainerGap()
  413.                 .addComponent(lbRegisteredTravels)
  414.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  415.                 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
  416.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  417.                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  418.                     .addGroup(contentPanelLayout.createSequentialGroup()
  419.                         .addGap(23, 23, 23)
  420.                         .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  421.                     .addComponent(lbNewTravels, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
  422.                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  423.                     .addGroup(contentPanelLayout.createSequentialGroup()
  424.                         .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  425.                             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, contentPanelLayout.createSequentialGroup()
  426.                                 .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  427.                                     .addComponent(lbPlaneCombo)
  428.                                     .addComponent(lbPilotCombo))
  429.                                 .addGap(25, 25, 25))
  430.                             .addGroup(contentPanelLayout.createSequentialGroup()
  431.                                 .addComponent(btNew, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
  432.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
  433.                         .addComponent(btCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
  434.                     .addGroup(contentPanelLayout.createSequentialGroup()
  435.                         .addGap(25, 25, 25)
  436.                         .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  437.                             .addComponent(btInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
  438.                             .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  439.                                 .addComponent(tfPassengers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  440.                                 .addComponent(tfLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  441.                                 .addComponent(tfDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
  442.                 .addContainerGap(21, Short.MAX_VALUE))
  443.         );
  444.  
  445.         javax.swing.GroupLayout rootPanelLayout = new javax.swing.GroupLayout(rootPanel);
  446.         rootPanel.setLayout(rootPanelLayout);
  447.         rootPanelLayout.setHorizontalGroup(
  448.             rootPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  449.             .addComponent(contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  450.         );
  451.         rootPanelLayout.setVerticalGroup(
  452.             rootPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  453.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rootPanelLayout.createSequentialGroup()
  454.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  455.                 .addComponent(contentPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  456.                 .addGap(65, 65, 65))
  457.         );
  458.  
  459.         topPanel.setBackground(new java.awt.Color(255, 255, 255));
  460.  
  461.         btAirplaneCategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  462.         btAirplaneCategory.setForeground(new java.awt.Color(0, 0, 0));
  463.         btAirplaneCategory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/cog.png"))); // NOI18N
  464.         btAirplaneCategory.setText("Categoria de Aviões");
  465.         btAirplaneCategory.setToolTipText("Gerenciamento de Aviões");
  466.         btAirplaneCategory.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  467.         btAirplaneCategory.setContentAreaFilled(false);
  468.         btAirplaneCategory.setFocusable(false);
  469.         btAirplaneCategory.addMouseListener(new java.awt.event.MouseAdapter() {
  470.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  471.                 btAirplaneCategoryMouseEntered(evt);
  472.             }
  473.             public void mouseExited(java.awt.event.MouseEvent evt) {
  474.                 btAirplaneCategoryMouseExited(evt);
  475.             }
  476.         });
  477.  
  478.         btPilot.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  479.         btPilot.setForeground(new java.awt.Color(0, 0, 0));
  480.         btPilot.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/users.png"))); // NOI18N
  481.         btPilot.setText("Pilotos");
  482.         btPilot.setToolTipText("Gerenciamento de Pilotos");
  483.         btPilot.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  484.         btPilot.setContentAreaFilled(false);
  485.         btPilot.setFocusable(false);
  486.         btPilot.addMouseListener(new java.awt.event.MouseAdapter() {
  487.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  488.                 btPilotMouseEntered(evt);
  489.             }
  490.             public void mouseExited(java.awt.event.MouseEvent evt) {
  491.                 btPilotMouseExited(evt);
  492.             }
  493.         });
  494.  
  495.         jLabel3.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
  496.         jLabel3.setForeground(new java.awt.Color(204, 204, 204));
  497.         jLabel3.setText("Gerenciamento :: ");
  498.  
  499.         btAirplane.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  500.         btAirplane.setForeground(new java.awt.Color(0, 0, 0));
  501.         btAirplane.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/airplane.png"))); // NOI18N
  502.         btAirplane.setText("Aviões");
  503.         btAirplane.setToolTipText("Gerenciamento de Aviões");
  504.         btAirplane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  505.         btAirplane.setContentAreaFilled(false);
  506.         btAirplane.setFocusable(false);
  507.         btAirplane.addMouseListener(new java.awt.event.MouseAdapter() {
  508.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  509.                 btAirplaneMouseEntered(evt);
  510.             }
  511.             public void mouseExited(java.awt.event.MouseEvent evt) {
  512.                 btAirplaneMouseExited(evt);
  513.             }
  514.         });
  515.  
  516.         btPilotCategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  517.         btPilotCategory.setForeground(new java.awt.Color(0, 0, 0));
  518.         btPilotCategory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/vcard.png"))); // NOI18N
  519.         btPilotCategory.setText("Categoria de Pilotos");
  520.         btPilotCategory.setToolTipText("Gerenciamento de Aviões");
  521.         btPilotCategory.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
  522.         btPilotCategory.setContentAreaFilled(false);
  523.         btPilotCategory.setFocusable(false);
  524.         btPilotCategory.addMouseListener(new java.awt.event.MouseAdapter() {
  525.             public void mouseEntered(java.awt.event.MouseEvent evt) {
  526.                 btPilotCategoryMouseEntered(evt);
  527.             }
  528.             public void mouseExited(java.awt.event.MouseEvent evt) {
  529.                 btPilotCategoryMouseExited(evt);
  530.             }
  531.         });
  532.  
  533.         javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
  534.         topPanel.setLayout(topPanelLayout);
  535.         topPanelLayout.setHorizontalGroup(
  536.             topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  537.             .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, topPanelLayout.createSequentialGroup()
  538.                 .addContainerGap(432, Short.MAX_VALUE)
  539.                 .addComponent(jLabel3)
  540.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  541.                 .addComponent(btPilot, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
  542.                 .addGap(18, 18, 18)
  543.                 .addComponent(btPilotCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
  544.                 .addGap(18, 18, 18)
  545.                 .addComponent(btAirplane, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
  546.                 .addGap(18, 18, 18)
  547.                 .addComponent(btAirplaneCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
  548.                 .addContainerGap())
  549.         );
  550.         topPanelLayout.setVerticalGroup(
  551.             topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  552.             .addGroup(topPanelLayout.createSequentialGroup()
  553.                 .addGap(29, 29, 29)
  554.                 .addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  555.                     .addComponent(btAirplaneCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
  556.                     .addComponent(btPilot, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
  557.                     .addComponent(jLabel3)
  558.                     .addComponent(btAirplane, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
  559.                     .addComponent(btPilotCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
  560.                 .addContainerGap(29, Short.MAX_VALUE))
  561.         );
  562.  
  563.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  564.         getContentPane().setLayout(layout);
  565.         layout.setHorizontalGroup(
  566.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  567.             .addComponent(rootPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  568.             .addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  569.         );
  570.         layout.setVerticalGroup(
  571.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  572.             .addGroup(layout.createSequentialGroup()
  573.                 .addComponent(topPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  574.                 .addGap(0, 0, Short.MAX_VALUE)
  575.                 .addComponent(rootPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 496, javax.swing.GroupLayout.PREFERRED_SIZE))
  576.         );
  577.  
  578.         pack();
  579.     }// </editor-fold>//GEN-END:initComponents
  580.  
  581.     private void btPilotMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotMouseEntered
  582.         if(btPilot.isEnabled())
  583.             btPilot.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  584.     }//GEN-LAST:event_btPilotMouseEntered
  585.  
  586.     private void btPilotMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotMouseExited
  587.        
  588.             btPilot.setBorder(new LineBorder(Color.white, 1, true));
  589.     }//GEN-LAST:event_btPilotMouseExited
  590.  
  591.     private void btAirplaneCategoryMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneCategoryMouseEntered
  592.         if(btAirplaneCategory.isEnabled())
  593.             btAirplaneCategory.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  594.     }//GEN-LAST:event_btAirplaneCategoryMouseEntered
  595.  
  596.     private void btAirplaneCategoryMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneCategoryMouseExited
  597.  
  598.             btAirplaneCategory.setBorder(new LineBorder(Color.white, 1, true));
  599.     }//GEN-LAST:event_btAirplaneCategoryMouseExited
  600.  
  601.     private void btNewMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNewMouseEntered
  602.         if(btNew.isEnabled())
  603.             btNew.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  604.     }//GEN-LAST:event_btNewMouseEntered
  605.  
  606.     private void btNewMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNewMouseExited
  607.  
  608.             btNew.setBorder(new LineBorder(Color.white, 1, true));
  609.     }//GEN-LAST:event_btNewMouseExited
  610.  
  611.     private void btCancelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelMouseEntered
  612.         if(btCancel.isEnabled())
  613.             btCancel.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  614.     }//GEN-LAST:event_btCancelMouseEntered
  615.  
  616.     private void btCancelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelMouseExited
  617.  
  618.             btCancel.setBorder(new LineBorder(Color.white, 1, true));
  619.     }//GEN-LAST:event_btCancelMouseExited
  620.  
  621.     private void tfPassengersFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfPassengersFocusGained
  622.         if (tfPassengers.getText() == null ? tfPassengers.getName() == null : tfPassengers.getText().equals(tfPassengers.getName())) {
  623.             tfPassengers.setText("");
  624.         }
  625.     }//GEN-LAST:event_tfPassengersFocusGained
  626.  
  627.     private void tfPassengersFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfPassengersFocusLost
  628.         if (("".equals(tfPassengers.getText())) || (tfPassengers.getText() == null)) {
  629.             tfPassengers.setText(tfPassengers.getName());
  630.         }
  631.     }//GEN-LAST:event_tfPassengersFocusLost
  632.  
  633.     private void tfLocationFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfLocationFocusGained
  634.         if (tfLocation.getText() == null ? tfLocation.getName() == null : tfLocation.getText().equals(tfLocation.getName())) {
  635.             tfLocation.setText("");
  636.         }
  637.     }//GEN-LAST:event_tfLocationFocusGained
  638.  
  639.     private void tfLocationFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfLocationFocusLost
  640.         if (("".equals(tfLocation.getText())) || (tfLocation.getText() == null)) {
  641.             tfLocation.setText(tfLocation.getName());
  642.         }
  643.     }//GEN-LAST:event_tfLocationFocusLost
  644.  
  645.     private void btAirplaneMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneMouseEntered
  646.         if(btAirplane.isEnabled())
  647.             btAirplane.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  648.     }//GEN-LAST:event_btAirplaneMouseEntered
  649.  
  650.     private void btAirplaneMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneMouseExited
  651.  
  652.             btAirplane.setBorder(new LineBorder(Color.white, 1, true));
  653.     }//GEN-LAST:event_btAirplaneMouseExited
  654.  
  655.     private void btPilotCategoryMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotCategoryMouseEntered
  656.         if(btPilotCategory.isEnabled())
  657.             btPilotCategory.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  658.     }//GEN-LAST:event_btPilotCategoryMouseEntered
  659.  
  660.     private void btPilotCategoryMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotCategoryMouseExited
  661.  
  662.             btPilotCategory.setBorder(new LineBorder(Color.white, 1, true));
  663.     }//GEN-LAST:event_btPilotCategoryMouseExited
  664.  
  665.     private void btInsertMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btInsertMouseEntered
  666.         if(btInsert.isEnabled())
  667.             btInsert.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
  668.     }//GEN-LAST:event_btInsertMouseEntered
  669.  
  670.     private void btInsertMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btInsertMouseExited
  671.  
  672.             btInsert.setBorder(new LineBorder(Color.white, 1, true));
  673.     }//GEN-LAST:event_btInsertMouseExited
  674.  
  675.     private void tfDateFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfDateFocusGained
  676.         if (tfDate.getText() == null ? tfDate.getName() == null : tfDate.getText().equals(tfDate.getName())) {
  677.             tfDate.setText("");
  678.         }
  679.     }//GEN-LAST:event_tfDateFocusGained
  680.  
  681.     private void tfDateFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfDateFocusLost
  682.         if (("".equals(tfDate.getText())) || (tfDate.getText() == null)) {
  683.             tfDate.setText(tfDate.getName());
  684.         }
  685.     }//GEN-LAST:event_tfDateFocusLost
  686.  
  687.     public static void main(String args[]) {
  688.         /* Set the Nimbus look and feel */
  689.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  690.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  691.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  692.          */
  693.         try {
  694.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  695.                 if ("Nimbus".equals(info.getName())) {
  696.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  697.                     break;
  698.                 }
  699.             }
  700.         } catch (ClassNotFoundException ex) {
  701.             java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  702.         } catch (InstantiationException ex) {
  703.             java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  704.         } catch (IllegalAccessException ex) {
  705.             java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  706.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  707.             java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  708.         }
  709.         //</editor-fold>
  710.  
  711.         /* Create and display the form */
  712.         java.awt.EventQueue.invokeLater(new Runnable() {
  713.             public void run() {
  714.                 new MainWindow().setVisible(true);
  715.             }
  716.         });
  717.     }
  718.  
  719.     // Variables declaration - do not modify//GEN-BEGIN:variables
  720.     private javax.swing.JButton btAirplane;
  721.     private javax.swing.JButton btAirplaneCategory;
  722.     private javax.swing.JButton btCancel;
  723.     private javax.swing.JButton btInsert;
  724.     private javax.swing.JButton btNew;
  725.     private javax.swing.JButton btPilot;
  726.     private javax.swing.JButton btPilotCategory;
  727.     private javax.swing.JPanel contentPanel;
  728.     private javax.swing.JLabel jLabel3;
  729.     private javax.swing.JScrollPane jScrollPane1;
  730.     private javax.swing.JSeparator jSeparator4;
  731.     private javax.swing.JLabel lbNewTravels;
  732.     private javax.swing.JLabel lbPilotCombo;
  733.     private javax.swing.JLabel lbPlaneCombo;
  734.     private javax.swing.JLabel lbRegisteredTravels;
  735.     private javax.swing.JPanel rootPanel;
  736.     private javax.swing.JTable table;
  737.     private javax.swing.JTextField tfDate;
  738.     private javax.swing.JTextField tfLocation;
  739.     private javax.swing.JTextField tfPassengers;
  740.     private javax.swing.JPanel topPanel;
  741.     // End of variables declaration//GEN-END:variables
  742.     // </editor-fold>  
  743.  
  744. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement