Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package aap.view;
- import java.awt.Color;
- import java.util.Vector;
- import javax.swing.JButton;
- import javax.swing.JComboBox;
- import javax.swing.JTable;
- import javax.swing.JTextField;
- import javax.swing.border.LineBorder;
- import javax.swing.table.DefaultTableModel;
- public class MainWindow extends javax.swing.JFrame {
- public MainWindow() {
- initComponents();
- Appearance appearance = new Appearance();
- appearance.tryUseSystemLookAndFeel(this);
- pilotCombo = new JComboBox();
- airplaneCombo = new JComboBox();
- pilotCombo.setBounds(680, 406, 180, 40);
- airplaneCombo.setBounds(880, 406, 180, 40);
- contentPanel.add(pilotCombo);
- contentPanel.add(airplaneCombo);
- this.setLocationRelativeTo(null);
- isNewMode(false);
- }
- private JComboBox pilotCombo, airplaneCombo;
- public void popTable(Vector<Vector> tBody) {
- Vector<String> tHead = new Vector();
- tHead.add("Piloto");
- tHead.add("Avião");
- tHead.add("Data");
- tHead.add("Destino");
- tHead.add("Passageiros");
- DefaultTableModel model = new DefaultTableModel(tBody, tHead);
- this.table.setModel(model);
- }
- public void popComboBox(Vector<Vector> list, int combo) {
- if( combo == 1) {
- if(pilotCombo.getItemCount() > 0)
- pilotCombo.removeAllItems();
- Vector current;
- for (int i = 0; i < list.size(); i++) {
- current = new Vector();
- current = list.get(i);
- pilotCombo.addItem(current.get(0));
- }
- } else if (combo == 2){
- if (airplaneCombo.getItemCount() > 0)
- airplaneCombo.removeAllItems();
- Vector current;
- for (int i = 0; i < list.size(); i++) {
- current = new Vector();
- current = list.get(i);
- airplaneCombo.addItem(current.get(0));
- }
- }
- }
- public void tfNormalState() {
- tfDate.setText(tfDate.getName());
- tfLocation.setText(tfLocation.getName());
- tfPassengers.setText(tfPassengers.getName());
- }
- public void isNewMode(boolean state) {
- tfLocation.setVisible(state);
- tfPassengers.setVisible(state);
- tfDate.setVisible(state);
- pilotCombo.setVisible(state);
- airplaneCombo.setVisible(state);
- lbPilotCombo.setVisible(state);
- lbPlaneCombo.setVisible(state);
- btInsert.setVisible(state);
- if (state) {
- btAirplane.setEnabled(false);
- btAirplaneCategory.setEnabled(false);
- btNew.setEnabled(false);
- btPilot.setEnabled(false);
- btPilotCategory.setEnabled(false);
- table.setEnabled(false);
- } else {
- btAirplane.setEnabled(true);
- btAirplaneCategory.setEnabled(true);
- btNew.setEnabled(true);
- btPilot.setEnabled(true);
- btPilotCategory.setEnabled(true);
- table.setEnabled(true);
- }
- btAirplane.setEnabled(false);
- }
- // <editor-fold defaultstate="collapsed" desc=". . . . . ">
- public JComboBox getPilotCombo() {
- return pilotCombo;
- }
- public void setPilotCombo(JComboBox pilotCombo) {
- this.pilotCombo = pilotCombo;
- }
- public JComboBox getAirplaneCombo() {
- return airplaneCombo;
- }
- public void setAirplaneCombo(JComboBox airplaneCombo) {
- this.airplaneCombo = airplaneCombo;
- }
- public JButton getBtAirplane() {
- return btAirplane;
- }
- public void setBtAirplane(JButton btAirplane) {
- this.btAirplane = btAirplane;
- }
- public JButton getBtAirplaneCategory() {
- return btAirplaneCategory;
- }
- public void setBtAirplaneCategory(JButton btAirplaneCategory) {
- this.btAirplaneCategory = btAirplaneCategory;
- }
- public JButton getBtInsert() {
- return btInsert;
- }
- public void setBtInsert(JButton btInsert) {
- this.btInsert = btInsert;
- }
- public JButton getBtCancel() {
- return btCancel;
- }
- public void setBtCancel(JButton btCancel) {
- this.btCancel = btCancel;
- }
- public JButton getBtNew() {
- return btNew;
- }
- public void setBtNew(JButton btNew) {
- this.btNew = btNew;
- }
- public JButton getBtPilot() {
- return btPilot;
- }
- public void setBtPilot(JButton btPilot) {
- this.btPilot = btPilot;
- }
- public JButton getBtPilotCategory() {
- return btPilotCategory;
- }
- public void setBtPilotCategory(JButton btPilotCategory) {
- this.btPilotCategory = btPilotCategory;
- }
- public JTable getTable() {
- return table;
- }
- public void setTable(JTable table) {
- this.table = table;
- }
- public JTextField getTfLocation() {
- return tfLocation;
- }
- public void setTfLocation(JTextField tfLocation) {
- this.tfLocation = tfLocation;
- }
- public JTextField getTfPassengers() {
- return tfPassengers;
- }
- public void setTfPassengers(JTextField tfPassengers) {
- this.tfPassengers = tfPassengers;
- }
- public JTextField getTfDate() {
- return tfDate;
- }
- public void setTfDate(JTextField tfDate) {
- this.tfDate = tfDate;
- }
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
- private void initComponents() {
- rootPanel = new javax.swing.JPanel();
- contentPanel = new javax.swing.JPanel();
- lbRegisteredTravels = new javax.swing.JLabel();
- jScrollPane1 = new javax.swing.JScrollPane();
- table = new javax.swing.JTable();
- lbNewTravels = new javax.swing.JLabel();
- btNew = new javax.swing.JButton();
- btCancel = new javax.swing.JButton();
- tfPassengers = new javax.swing.JTextField();
- jSeparator4 = new javax.swing.JSeparator();
- tfLocation = new javax.swing.JTextField();
- lbPilotCombo = new javax.swing.JLabel();
- lbPlaneCombo = new javax.swing.JLabel();
- btInsert = new javax.swing.JButton();
- tfDate = new javax.swing.JTextField();
- topPanel = new javax.swing.JPanel();
- btAirplaneCategory = new javax.swing.JButton();
- btPilot = new javax.swing.JButton();
- jLabel3 = new javax.swing.JLabel();
- btAirplane = new javax.swing.JButton();
- btPilotCategory = new javax.swing.JButton();
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- setResizable(false);
- rootPanel.setBackground(new java.awt.Color(102, 102, 102));
- contentPanel.setBackground(new java.awt.Color(255, 255, 255));
- lbRegisteredTravels.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- lbRegisteredTravels.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/flag.png"))); // NOI18N
- lbRegisteredTravels.setText("Viagens registradas");
- table.setFont(new java.awt.Font("Tahoma", 0, 16)); // NOI18N
- table.setModel(new javax.swing.table.DefaultTableModel(
- new Object [][] {
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null},
- {null, null, null, null, null}
- },
- new String [] {
- "Piloto", "Avião", "Data", "Destino", "Passageiros "
- }
- ));
- table.setGridColor(new java.awt.Color(204, 204, 204));
- table.setRowHeight(28);
- table.setSelectionBackground(new java.awt.Color(204, 204, 204));
- table.setSurrendersFocusOnKeystroke(true);
- jScrollPane1.setViewportView(table);
- lbNewTravels.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- lbNewTravels.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/plus.png"))); // NOI18N
- lbNewTravels.setText("Controle de Viagens");
- btNew.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btNew.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
- btNew.setText("Nova");
- btNew.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btNew.setContentAreaFilled(false);
- btNew.setFocusable(false);
- btNew.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- btNew.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btNewMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btNewMouseExited(evt);
- }
- });
- btCancel.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btCancel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
- btCancel.setText("Cancelamento");
- btCancel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btCancel.setContentAreaFilled(false);
- btCancel.setFocusable(false);
- btCancel.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- btCancel.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btCancelMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btCancelMouseExited(evt);
- }
- });
- tfPassengers.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
- tfPassengers.setForeground(new java.awt.Color(102, 102, 102));
- tfPassengers.setText("Passageiros");
- tfPassengers.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
- tfPassengers.setName("Passageiros"); // NOI18N
- tfPassengers.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- tfPassengersFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- tfPassengersFocusLost(evt);
- }
- });
- jSeparator4.setForeground(new java.awt.Color(240, 240, 240));
- tfLocation.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
- tfLocation.setForeground(new java.awt.Color(102, 102, 102));
- tfLocation.setText("Destino");
- tfLocation.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
- tfLocation.setName("Destino"); // NOI18N
- tfLocation.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- tfLocationFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- tfLocationFocusLost(evt);
- }
- });
- lbPilotCombo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- lbPilotCombo.setForeground(new java.awt.Color(153, 153, 153));
- lbPilotCombo.setText("Pilotos disponíveis");
- lbPlaneCombo.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- lbPlaneCombo.setForeground(new java.awt.Color(153, 153, 153));
- lbPlaneCombo.setText("Aviões disponíveis");
- btInsert.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btInsert.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/arrow-right.png"))); // NOI18N
- btInsert.setText("Inserir");
- btInsert.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btInsert.setContentAreaFilled(false);
- btInsert.setFocusable(false);
- btInsert.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
- btInsert.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btInsertMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btInsertMouseExited(evt);
- }
- });
- tfDate.setFont(new java.awt.Font("Segoe UI Light", 0, 24)); // NOI18N
- tfDate.setForeground(new java.awt.Color(102, 102, 102));
- tfDate.setText("Data");
- tfDate.setBorder(javax.swing.BorderFactory.createMatteBorder(0, 0, 1, 0, new java.awt.Color(204, 204, 204)));
- tfDate.setName("Data"); // NOI18N
- tfDate.addFocusListener(new java.awt.event.FocusAdapter() {
- public void focusGained(java.awt.event.FocusEvent evt) {
- tfDateFocusGained(evt);
- }
- public void focusLost(java.awt.event.FocusEvent evt) {
- tfDateFocusLost(evt);
- }
- });
- javax.swing.GroupLayout contentPanelLayout = new javax.swing.GroupLayout(contentPanel);
- contentPanel.setLayout(contentPanelLayout);
- contentPanelLayout.setHorizontalGroup(
- contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(29, 29, 29)
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lbRegisteredTravels, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(btCancel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(btNew, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(lbNewTravels, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(523, 523, 523)
- .addComponent(lbPilotCombo)
- .addGap(78, 78, 78)
- .addComponent(lbPlaneCombo))
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(12, 12, 12)
- .addComponent(tfPassengers, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(tfLocation, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(tfDate, javax.swing.GroupLayout.PREFERRED_SIZE, 141, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGap(0, 194, Short.MAX_VALUE))
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(btInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(jSeparator4)))))))
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jScrollPane1)))
- .addContainerGap())
- );
- contentPanelLayout.setVerticalGroup(
- contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(lbRegisteredTravels)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(23, 23, 23)
- .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addComponent(lbNewTravels, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, contentPanelLayout.createSequentialGroup()
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(lbPlaneCombo)
- .addComponent(lbPilotCombo))
- .addGap(25, 25, 25))
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addComponent(btNew, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
- .addComponent(btCancel, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(contentPanelLayout.createSequentialGroup()
- .addGap(25, 25, 25)
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(btInsert, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(contentPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(tfPassengers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(tfLocation, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(tfDate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
- .addContainerGap(21, Short.MAX_VALUE))
- );
- javax.swing.GroupLayout rootPanelLayout = new javax.swing.GroupLayout(rootPanel);
- rootPanel.setLayout(rootPanelLayout);
- rootPanelLayout.setHorizontalGroup(
- rootPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(contentPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- );
- rootPanelLayout.setVerticalGroup(
- rootPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, rootPanelLayout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(contentPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(65, 65, 65))
- );
- topPanel.setBackground(new java.awt.Color(255, 255, 255));
- btAirplaneCategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btAirplaneCategory.setForeground(new java.awt.Color(0, 0, 0));
- btAirplaneCategory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/cog.png"))); // NOI18N
- btAirplaneCategory.setText("Categoria de Aviões");
- btAirplaneCategory.setToolTipText("Gerenciamento de Aviões");
- btAirplaneCategory.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btAirplaneCategory.setContentAreaFilled(false);
- btAirplaneCategory.setFocusable(false);
- btAirplaneCategory.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btAirplaneCategoryMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btAirplaneCategoryMouseExited(evt);
- }
- });
- btPilot.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btPilot.setForeground(new java.awt.Color(0, 0, 0));
- btPilot.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/users.png"))); // NOI18N
- btPilot.setText("Pilotos");
- btPilot.setToolTipText("Gerenciamento de Pilotos");
- btPilot.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btPilot.setContentAreaFilled(false);
- btPilot.setFocusable(false);
- btPilot.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btPilotMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btPilotMouseExited(evt);
- }
- });
- jLabel3.setFont(new java.awt.Font("Segoe UI Light", 0, 18)); // NOI18N
- jLabel3.setForeground(new java.awt.Color(204, 204, 204));
- jLabel3.setText("Gerenciamento :: ");
- btAirplane.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btAirplane.setForeground(new java.awt.Color(0, 0, 0));
- btAirplane.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/airplane.png"))); // NOI18N
- btAirplane.setText("Aviões");
- btAirplane.setToolTipText("Gerenciamento de Aviões");
- btAirplane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btAirplane.setContentAreaFilled(false);
- btAirplane.setFocusable(false);
- btAirplane.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btAirplaneMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btAirplaneMouseExited(evt);
- }
- });
- btPilotCategory.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
- btPilotCategory.setForeground(new java.awt.Color(0, 0, 0));
- btPilotCategory.setIcon(new javax.swing.ImageIcon(getClass().getResource("/aap/image/vcard.png"))); // NOI18N
- btPilotCategory.setText("Categoria de Pilotos");
- btPilotCategory.setToolTipText("Gerenciamento de Aviões");
- btPilotCategory.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(255, 255, 255)));
- btPilotCategory.setContentAreaFilled(false);
- btPilotCategory.setFocusable(false);
- btPilotCategory.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseEntered(java.awt.event.MouseEvent evt) {
- btPilotCategoryMouseEntered(evt);
- }
- public void mouseExited(java.awt.event.MouseEvent evt) {
- btPilotCategoryMouseExited(evt);
- }
- });
- javax.swing.GroupLayout topPanelLayout = new javax.swing.GroupLayout(topPanel);
- topPanel.setLayout(topPanelLayout);
- topPanelLayout.setHorizontalGroup(
- topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, topPanelLayout.createSequentialGroup()
- .addContainerGap(432, Short.MAX_VALUE)
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(btPilot, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(btPilotCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(btAirplane, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(18, 18, 18)
- .addComponent(btAirplaneCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
- topPanelLayout.setVerticalGroup(
- topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(topPanelLayout.createSequentialGroup()
- .addGap(29, 29, 29)
- .addGroup(topPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(btAirplaneCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btPilot, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel3)
- .addComponent(btAirplane, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(btPilotCategory, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addContainerGap(29, Short.MAX_VALUE))
- );
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(rootPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(topPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(topPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(rootPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 496, javax.swing.GroupLayout.PREFERRED_SIZE))
- );
- pack();
- }// </editor-fold>//GEN-END:initComponents
- private void btPilotMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotMouseEntered
- if(btPilot.isEnabled())
- btPilot.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btPilotMouseEntered
- private void btPilotMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotMouseExited
- btPilot.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btPilotMouseExited
- private void btAirplaneCategoryMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneCategoryMouseEntered
- if(btAirplaneCategory.isEnabled())
- btAirplaneCategory.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btAirplaneCategoryMouseEntered
- private void btAirplaneCategoryMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneCategoryMouseExited
- btAirplaneCategory.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btAirplaneCategoryMouseExited
- private void btNewMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNewMouseEntered
- if(btNew.isEnabled())
- btNew.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btNewMouseEntered
- private void btNewMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btNewMouseExited
- btNew.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btNewMouseExited
- private void btCancelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelMouseEntered
- if(btCancel.isEnabled())
- btCancel.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btCancelMouseEntered
- private void btCancelMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btCancelMouseExited
- btCancel.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btCancelMouseExited
- private void tfPassengersFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfPassengersFocusGained
- if (tfPassengers.getText() == null ? tfPassengers.getName() == null : tfPassengers.getText().equals(tfPassengers.getName())) {
- tfPassengers.setText("");
- }
- }//GEN-LAST:event_tfPassengersFocusGained
- private void tfPassengersFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfPassengersFocusLost
- if (("".equals(tfPassengers.getText())) || (tfPassengers.getText() == null)) {
- tfPassengers.setText(tfPassengers.getName());
- }
- }//GEN-LAST:event_tfPassengersFocusLost
- private void tfLocationFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfLocationFocusGained
- if (tfLocation.getText() == null ? tfLocation.getName() == null : tfLocation.getText().equals(tfLocation.getName())) {
- tfLocation.setText("");
- }
- }//GEN-LAST:event_tfLocationFocusGained
- private void tfLocationFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfLocationFocusLost
- if (("".equals(tfLocation.getText())) || (tfLocation.getText() == null)) {
- tfLocation.setText(tfLocation.getName());
- }
- }//GEN-LAST:event_tfLocationFocusLost
- private void btAirplaneMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneMouseEntered
- if(btAirplane.isEnabled())
- btAirplane.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btAirplaneMouseEntered
- private void btAirplaneMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btAirplaneMouseExited
- btAirplane.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btAirplaneMouseExited
- private void btPilotCategoryMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotCategoryMouseEntered
- if(btPilotCategory.isEnabled())
- btPilotCategory.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btPilotCategoryMouseEntered
- private void btPilotCategoryMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btPilotCategoryMouseExited
- btPilotCategory.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btPilotCategoryMouseExited
- private void btInsertMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btInsertMouseEntered
- if(btInsert.isEnabled())
- btInsert.setBorder(new LineBorder(Color.LIGHT_GRAY, 1, true));
- }//GEN-LAST:event_btInsertMouseEntered
- private void btInsertMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btInsertMouseExited
- btInsert.setBorder(new LineBorder(Color.white, 1, true));
- }//GEN-LAST:event_btInsertMouseExited
- private void tfDateFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfDateFocusGained
- if (tfDate.getText() == null ? tfDate.getName() == null : tfDate.getText().equals(tfDate.getName())) {
- tfDate.setText("");
- }
- }//GEN-LAST:event_tfDateFocusGained
- private void tfDateFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tfDateFocusLost
- if (("".equals(tfDate.getText())) || (tfDate.getText() == null)) {
- tfDate.setText(tfDate.getName());
- }
- }//GEN-LAST:event_tfDateFocusLost
- 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(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(MainWindow.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(MainWindow.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 MainWindow().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.JButton btAirplane;
- private javax.swing.JButton btAirplaneCategory;
- private javax.swing.JButton btCancel;
- private javax.swing.JButton btInsert;
- private javax.swing.JButton btNew;
- private javax.swing.JButton btPilot;
- private javax.swing.JButton btPilotCategory;
- private javax.swing.JPanel contentPanel;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JScrollPane jScrollPane1;
- private javax.swing.JSeparator jSeparator4;
- private javax.swing.JLabel lbNewTravels;
- private javax.swing.JLabel lbPilotCombo;
- private javax.swing.JLabel lbPlaneCombo;
- private javax.swing.JLabel lbRegisteredTravels;
- private javax.swing.JPanel rootPanel;
- private javax.swing.JTable table;
- private javax.swing.JTextField tfDate;
- private javax.swing.JTextField tfLocation;
- private javax.swing.JTextField tfPassengers;
- private javax.swing.JPanel topPanel;
- // End of variables declaration//GEN-END:variables
- // </editor-fold>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement