Revision: 65143
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 30, 2013 06:56 by saaarb97
Initial Code
package ultraflightsincapp;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.JOptionPane;
public class UserInterface extends javax.swing.JFrame {
private boolean temp = false;
private int TicketNum;
private String Email = "Temp";
private String LoggedUser;
private boolean Registerd;
public UserInterface() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
UserMainDialog = new javax.swing.JDialog();
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel();
jCmboBoxFlightsList = new javax.swing.JComboBox();
jScrollPane1 = new javax.swing.JScrollPane();
jTxtAreaInfo = new javax.swing.JTextArea();
jLabel16 = new javax.swing.JLabel();
jLabel17 = new javax.swing.JLabel();
jTxtTicktsNum = new javax.swing.JTextField();
jLblOrders = new javax.swing.JLabel();
jLabel19 = new javax.swing.JLabel();
jCmboBoxOrdersList = new javax.swing.JComboBox();
jScrollPane2 = new javax.swing.JScrollPane();
jTxtAreaOrderInfo = new javax.swing.JTextArea();
jBtnPurchaseTickets = new javax.swing.JButton();
jLabel31 = new javax.swing.JLabel();
jButton2 = new javax.swing.JButton();
jLabel32 = new javax.swing.JLabel();
jLblCost = new javax.swing.JLabel();
ManagerMainDialog = new javax.swing.JDialog();
jLabel1 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
jCmboBoxOrigin = new javax.swing.JComboBox();
jCmboBoxDest = new javax.swing.JComboBox();
jCmboBoxflightAttendantsNum = new javax.swing.JComboBox();
jCmboBoxPlaneType = new javax.swing.JComboBox();
jBtnCreateFlight = new javax.swing.JButton();
jLabel33 = new javax.swing.JLabel();
jButton3 = new javax.swing.JButton();
PurchaseWindow = new javax.swing.JDialog();
jPanel2 = new javax.swing.JPanel();
jLabel20 = new javax.swing.JLabel();
jLabel21 = new javax.swing.JLabel();
jLabel22 = new javax.swing.JLabel();
jLabel23 = new javax.swing.JLabel();
jCmboBoxMonth = new javax.swing.JComboBox();
jCmboBoxYear = new javax.swing.JComboBox();
jTxtCode = new javax.swing.JTextField();
jTxtCCard = new javax.swing.JTextField();
jLabel24 = new javax.swing.JLabel();
jLabel25 = new javax.swing.JLabel();
jLabel26 = new javax.swing.JLabel();
jTxtBillingName = new javax.swing.JTextField();
jLabel27 = new javax.swing.JLabel();
jTxtCity = new javax.swing.JTextField();
jLabel28 = new javax.swing.JLabel();
jTxtAddress = new javax.swing.JTextField();
jLabel29 = new javax.swing.JLabel();
jTxtZip = new javax.swing.JTextField();
jLabel30 = new javax.swing.JLabel();
jTxtPhone = new javax.swing.JTextField();
jSeparator1 = new javax.swing.JSeparator();
jBtmPurchaseContinue = new javax.swing.JButton();
jLblPayment = new javax.swing.JLabel();
jLblTotalPayment = new javax.swing.JLabel();
jLblTo = new javax.swing.JLabel();
jBtnAccept = new javax.swing.JButton();
jBtnEdit = new javax.swing.JButton();
jScrollPane3 = new javax.swing.JScrollPane();
jTxtAreaBillingInfo = new javax.swing.JTextArea();
jLblName = new javax.swing.JLabel();
jLabel35 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
JBtmRegister = new javax.swing.JButton();
JtxtRegistEmail = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
JtxtLoginName = new javax.swing.JTextField();
JBtmUserLogin = new javax.swing.JButton();
JBtmMangLogin = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
JTxtName = new javax.swing.JTextField();
jCmboBoxPassangers = new javax.swing.JComboBox();
jCmboBoxEmails = new javax.swing.JComboBox();
jPassFieldRegis = new javax.swing.JPasswordField();
jPassFieldLogin = new javax.swing.JPasswordField();
jLabel36 = new javax.swing.JLabel();
jLabel18 = new javax.swing.JLabel();
jLabel34 = new javax.swing.JLabel();
UserMainDialog.setMinimumSize(new java.awt.Dimension(662, 333));
UserMainDialog.setResizable(false);
UserMainDialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
UserMainDialogWindowActivated(evt);
}
public void windowClosed(java.awt.event.WindowEvent evt) {
UserMainDialogWindowClosed(evt);
}
public void windowOpened(java.awt.event.WindowEvent evt) {
UserMainDialogWindowOpened(evt);
}
});
jLabel14.setText("purchase flight tickets");
jLabel15.setText("Available flights:");
jCmboBoxFlightsList.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
jCmboBoxFlightsListItemStateChanged(evt);
}
});
jCmboBoxFlightsList.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCmboBoxFlightsListActionPerformed(evt);
}
});
jTxtAreaInfo.setColumns(20);
jTxtAreaInfo.setRows(5);
jScrollPane1.setViewportView(jTxtAreaInfo);
jLabel16.setText("Flight information:");
jLabel17.setText("Number of tickets:");
jTxtTicktsNum.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
jTxtTicktsNumKeyReleased(evt);
}
});
jLblOrders.setText("Your orders:");
jLabel19.setText("Order number:");
jCmboBoxOrdersList.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " }));
jTxtAreaOrderInfo.setColumns(20);
jTxtAreaOrderInfo.setRows(5);
jScrollPane2.setViewportView(jTxtAreaOrderInfo);
jBtnPurchaseTickets.setText("Continue purchase");
jBtnPurchaseTickets.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnPurchaseTicketsActionPerformed(evt);
}
});
jLabel31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel31.setText("Ultra Flights Inc.");
jLabel31.setVerticalAlignment(javax.swing.SwingConstants.TOP);
jLabel31.setDoubleBuffered(true);
jButton2.setText("Back");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
jLabel32.setText("Will cost:");
jLblCost.setText("*********");
javax.swing.GroupLayout UserMainDialogLayout = new javax.swing.GroupLayout(UserMainDialog.getContentPane());
UserMainDialog.getContentPane().setLayout(UserMainDialogLayout);
UserMainDialogLayout.setHorizontalGroup(
UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, UserMainDialogLayout.createSequentialGroup()
.addContainerGap(478, Short.MAX_VALUE)
.addComponent(jLblOrders)
.addGap(124, 124, 124))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, UserMainDialogLayout.createSequentialGroup()
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel16)
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addComponent(jLabel17)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTxtTicktsNum, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel32)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLblCost))
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addComponent(jLabel15)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14)
.addComponent(jCmboBoxFlightsList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128, Short.MAX_VALUE)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, UserMainDialogLayout.createSequentialGroup()
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCmboBoxOrdersList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addGap(38, 38, 38)
.addComponent(jBtnPurchaseTickets)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 446, Short.MAX_VALUE)
.addComponent(jButton2))
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addGap(279, 279, 279)
.addComponent(jLabel31))
);
UserMainDialogLayout.setVerticalGroup(
UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addComponent(jLabel31)
.addGap(18, 18, 18)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLblOrders)
.addComponent(jLabel14))
.addGap(33, 33, 33)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel15)
.addComponent(jCmboBoxFlightsList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel19)
.addComponent(jCmboBoxOrdersList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addComponent(jLabel16)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(27, 27, 27)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton2)
.addGroup(UserMainDialogLayout.createSequentialGroup()
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTxtTicktsNum, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel17)
.addComponent(jLabel32)
.addComponent(jLblCost)))
.addGap(31, 31, 31)
.addComponent(jBtnPurchaseTickets)
.addContainerGap())))
);
ManagerMainDialog.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
ManagerMainDialogWindowClosed(evt);
}
});
jLabel1.setText("Managers console - if you are not a managr please relog.");
jLabel10.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
jLabel10.setText("Flight route creation");
jLabel9.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel9.setText("Origin of flight:");
jLabel11.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel11.setText("Destination of flight:");
jLabel12.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel12.setText("Number of flight attendants:");
jLabel13.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
jLabel13.setText("Plane type:");
jCmboBoxOrigin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ben Gurion , Israel", "Amman , Jordem", "Frankfurt , Germany", "Munich , Germany", "Berlin Tempelh , Germany", "Warsaw , Poland", "Roma Ciampino , Italy", "Geneva , Swizerland", "Zurich , Swizerland", "London City , England", "Paris , France", "Bucharest Baneasa , Romania", "New York , USA", "Las Vegas , USA", "New Delhi , India", "Bangkok , Thailand", "Tokyo , Japan", "Hong Kong , China", "Beijing , China", "Nicosia , Cyprus", "Oslo , Norway", "Madrid , Spain", "Istanbul , Turkey", " " }));
jCmboBoxDest.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ben Gurion , Israel", "Amman , Jordem", "Frankfurt , Germany", "Munich , Germany", "Berlin Tempelh , Germany", "Warsaw , Poland", "Roma Ciampino , Italy", "Geneva , Swizerland", "Zurich , Swizerland", "London City , England", "Paris , France", "Bucharest Baneasa , Romania", "New York , USA", "Las Vegas , USA", "New Delhi , India", "Bangkok , Thailand", "Tokyo , Japan", "Hong Kong , China", "Beijing , China", "Nicosia , Cyprus", "Oslo , Norway", "Madrid , Spain", "Istanbul , Turkey" }));
jCmboBoxflightAttendantsNum.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4", "5", "6", "7", "8", "9", "10" }));
jCmboBoxPlaneType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Boeing 737-900ER", "Boeing 747-400", "Boeing 767-300ER", "Boeing 737-800" }));
jBtnCreateFlight.setText("Create flight");
jBtnCreateFlight.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnCreateFlightActionPerformed(evt);
}
});
jLabel33.setText("Ultra Flights Inc.");
jButton3.setText("Back");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
javax.swing.GroupLayout ManagerMainDialogLayout = new javax.swing.GroupLayout(ManagerMainDialog.getContentPane());
ManagerMainDialog.getContentPane().setLayout(ManagerMainDialogLayout);
ManagerMainDialogLayout.setHorizontalGroup(
ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(ManagerMainDialogLayout.createSequentialGroup()
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(ManagerMainDialogLayout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(56, 56, 56)
.addComponent(jLabel33))
.addGroup(ManagerMainDialogLayout.createSequentialGroup()
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel12)
.addComponent(jLabel11)
.addComponent(jLabel9)
.addComponent(jLabel13)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ManagerMainDialogLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jBtnCreateFlight)))
.addGap(10, 10, 10)
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCmboBoxPlaneType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxOrigin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxflightAttendantsNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxDest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(ManagerMainDialogLayout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel10)))
.addContainerGap(245, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ManagerMainDialogLayout.createSequentialGroup()
.addContainerGap(599, Short.MAX_VALUE)
.addComponent(jButton3))
);
ManagerMainDialogLayout.setVerticalGroup(
ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(ManagerMainDialogLayout.createSequentialGroup()
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(jLabel33))
.addGap(18, 18, 18)
.addComponent(jLabel10)
.addGap(35, 35, 35)
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(jCmboBoxOrigin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel11)
.addComponent(jCmboBoxDest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(jCmboBoxflightAttendantsNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addComponent(jCmboBoxPlaneType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(jBtnCreateFlight)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
.addComponent(jButton3))
);
PurchaseWindow.setMinimumSize(new java.awt.Dimension(662, 333));
PurchaseWindow.addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
PurchaseWindowWindowClosed(evt);
}
public void windowOpened(java.awt.event.WindowEvent evt) {
PurchaseWindowWindowOpened(evt);
}
});
jPanel2.setPreferredSize(new java.awt.Dimension(662, 333));
jLabel20.setText("Purchase tickets");
jLabel21.setText("We accept the following secure payment methods: Visa , MasterCard and American Express");
jLabel22.setText("Card number");
jLabel23.setText("Expiration date and security code");
jCmboBoxMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
jCmboBoxYear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "----", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
jLabel24.setText("Payment information");
jLabel25.setText("Billing information");
jLabel26.setText("Name:");
jTxtBillingName.setEnabled(false);
jLabel27.setText("City");
jLabel28.setText("Billing address");
jLabel29.setText("Zip or postal code");
jLabel30.setText("Phone number");
jSeparator1.setBackground(new java.awt.Color(0, 0, 0));
jSeparator1.setForeground(new java.awt.Color(0, 0, 0));
jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
jBtmPurchaseContinue.setText("Continue");
jBtmPurchaseContinue.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtmPurchaseContinueActionPerformed(evt);
}
});
jLblPayment.setText("Total payment:");
jLblTotalPayment.setText("*******");
jLblTo.setText("To:");
jBtnAccept.setText("Accept");
jBtnAccept.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnAcceptActionPerformed(evt);
}
});
jBtnEdit.setText("Edit");
jBtnEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBtnEditActionPerformed(evt);
}
});
jTxtAreaBillingInfo.setColumns(20);
jTxtAreaBillingInfo.setRows(5);
jScrollPane3.setViewportView(jTxtAreaBillingInfo);
jLblName.setText("*******");
jLabel35.setText("Ultra Flights Inc.");
jButton1.setText("Back");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel21)
.addComponent(jLabel24)
.addComponent(jLabel25)
.addComponent(jLabel30)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jTxtAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
.addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTxtCCard)
.addComponent(jLabel26, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTxtBillingName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel28, javax.swing.GroupLayout.Alignment.LEADING))
.addComponent(jTxtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(125, 125, 125)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jBtmPurchaseContinue)
.addComponent(jTxtCity, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTxtZip, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel29)
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jCmboBoxMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jCmboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jTxtCode, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel23)
.addComponent(jLabel27))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel20)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel35)
.addGap(135, 135, 135)))
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(0, 12, Short.MAX_VALUE)
.addComponent(jBtnAccept)
.addGap(18, 18, 18)
.addComponent(jBtnEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(23, 23, 23))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
.addComponent(jLblPayment)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLblTotalPayment, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
.addComponent(jLblTo)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLblName, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)
.addContainerGap())
.addComponent(jButton1)))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(9, 9, 9)
.addComponent(jLabel20))
.addComponent(jLabel35))
.addGap(14, 14, 14)
.addComponent(jLabel24)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel21)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel22))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTxtCCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTxtCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel25)
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTxtBillingName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTxtCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel28)
.addComponent(jLabel29))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTxtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTxtZip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jLabel30)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTxtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jBtmPurchaseContinue))
.addGap(0, 2, Short.MAX_VALUE))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(47, 47, 47)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLblPayment)
.addComponent(jLblTotalPayment, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLblTo)
.addComponent(jLblName))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jBtnAccept)
.addComponent(jBtnEdit))
.addGap(29, 29, 29)
.addComponent(jButton1))
);
javax.swing.GroupLayout PurchaseWindowLayout = new javax.swing.GroupLayout(PurchaseWindow.getContentPane());
PurchaseWindow.getContentPane().setLayout(PurchaseWindowLayout);
PurchaseWindowLayout.setHorizontalGroup(
PurchaseWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
PurchaseWindowLayout.setVerticalGroup(
PurchaseWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setMaximumSize(new java.awt.Dimension(662, 333));
jPanel1.setMinimumSize(new java.awt.Dimension(662, 333));
JBtmRegister.setText("Register");
JBtmRegister.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBtmRegisterActionPerformed(evt);
}
});
jLabel2.setText("Email address:");
jLabel3.setText("Password:");
jLabel4.setText("First and last name:");
jLabel5.setText("Password:");
JBtmUserLogin.setText("User login");
JBtmUserLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBtmUserLoginActionPerformed(evt);
}
});
JBtmMangLogin.setText("Manager login");
JBtmMangLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBtmMangLoginActionPerformed(evt);
}
});
jLabel6.setText("User/Admin login");
jLabel7.setText("Register");
jLabel8.setText("First and last name:");
jLabel36.setText("Ultra Flights Inc.");
jLabel18.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel18.setText("*Case sesitive");
jLabel34.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
jLabel34.setText("*Case sesitive");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(311, 311, 311)
.addComponent(jLabel36))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(294, 294, 294)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(100, 100, 100)
.addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(304, 304, 304)
.addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel8)
.addGap(5, 5, 5)
.addComponent(JTxtName, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(110, 110, 110)
.addComponent(jLabel4)
.addGap(5, 5, 5)
.addComponent(JtxtLoginName, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(JtxtRegistEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(110, 110, 110)
.addComponent(jLabel5)
.addGap(50, 50, 50)
.addComponent(jPassFieldLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(jPassFieldRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(JBtmRegister)
.addGap(257, 257, 257)
.addComponent(JBtmUserLogin)
.addGap(11, 11, 11)
.addComponent(JBtmMangLogin))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(jCmboBoxPassangers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(jCmboBoxEmails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel36)
.addGap(5, 5, 5)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(14, 14, 14)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel34)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jLabel18)))
.addGap(3, 3, 3)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(6, 6, 6)
.addComponent(jLabel8))
.addComponent(JTxtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)
.addComponent(JtxtLoginName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(JtxtRegistEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jPassFieldLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jPassFieldRegis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(20, 20, 20)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(JBtmRegister)
.addComponent(JBtmUserLogin)
.addComponent(JBtmMangLogin))
.addGap(9, 9, 9)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jCmboBoxPassangers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jCmboBoxEmails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
private void JBtmRegisterActionPerformed(java.awt.event.ActionEvent evt) {
String tempString2 = null, tempString = null;
Pattern p1 = Pattern.compile("@");
Matcher m1 = p1.matcher(this.JtxtRegistEmail.getText());
Pattern p2 = Pattern.compile(".com");
Matcher m2 = p2.matcher(this.JtxtRegistEmail.getText());
Pattern p3 = Pattern.compile(" ");
Matcher m3 = p3.matcher(this.JTxtName.getText());
if (this.JtxtRegistEmail.getText().equals("") || this.jPassFieldRegis.getText().equals("") || this.JTxtName.getText().equals("")) {
JOptionPane.showMessageDialog(this, "Must enter Email and password");
} else if (!m1.find() || !m2.find()) {
JOptionPane.showMessageDialog(rootPane, "Must enter a valid Email");
} else if (!m3.find()) {
JOptionPane.showMessageDialog(rootPane, "Must enter first name AND last name");
} else {
tempString = this.JTxtName.getText();
for (int i1 = 0; i1 < this.jCmboBoxPassangers.getItemCount(); i1++) {
if (tempString.equals(this.jCmboBoxPassangers.getItemAt(i1).toString())) {
JOptionPane.showMessageDialog(rootPane, "Name already in use");
} else {
tempString2 = this.JTxtName.getText();
}
}
for (int i2 = 0; i2 < this.jCmboBoxPassangers.getItemCount(); i2++) {
if (tempString2.equals(this.jCmboBoxEmails.getItemAt(i2).toString())) {
JOptionPane.showMessageDialog(rootPane, "Email already in use");
} else {
if (Registerd = false) {
String filename = this.JTxtName.getText();
FileWriter fileWriter;
FileWriter fileWriter2;
FileWriter fileWriter3;
try {
fileWriter = new FileWriter("DataFiles/Passengers/" + filename + ".txt", true);
fileWriter2 = new FileWriter("DataFiles/Passengers/PassengersList.txt", true);
fileWriter3 = new FileWriter("DataFiles/Passengers/PassengersEmailsList.txt", true);
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write("Name: " + filename);
bufferedWriter.newLine();
bufferedWriter.write("Email: " + this.JtxtRegistEmail.getText());
bufferedWriter.newLine();
bufferedWriter.write("Password: " + this.jPassFieldRegis.getText());
bufferedWriter.newLine();
BufferedWriter bufferedWriter2 = new BufferedWriter(fileWriter2);
bufferedWriter2.write(filename);
bufferedWriter2.newLine();
bufferedWriter.close();
bufferedWriter2.close();
BufferedWriter bufferedWriter3 = new BufferedWriter(fileWriter3);
bufferedWriter3.write(this.JtxtRegistEmail.getText());
bufferedWriter3.newLine();
bufferedWriter3.close();
jCmboBoxPassangers.addItem(filename);
jCmboBoxEmails.addItem(this.JtxtRegistEmail);
Registerd = true;
JOptionPane.showMessageDialog(rootPane, "Thank you for registering to Ultra Flights Application " + filename + "!");
this.JtxtRegistEmail.setText("");
this.jPassFieldRegis.setText("");
this.JTxtName.setText("");
this.setVisible(false);
UserMainDialog.setVisible(true);
UserMainDialog.pack();
} catch (IOException ex) {
Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
}
}
}
}
}
}
private void JBtmUserLoginActionPerformed(java.awt.event.ActionEvent evt) {
String line3 = null;
String tempstring = null;
String password;
if (JtxtLoginName.getText().equals("") || jPassFieldLogin.getText().equals("")) {
JOptionPane.showMessageDialog(rootPane, "Your login input is missing.");
} else {
boolean isfound = false;
tempstring = JtxtLoginName.getText();
for (int i = 0; i < jCmboBoxPassangers.getItemCount(); i++) {
if ((tempstring.equals(jCmboBoxPassangers.getItemAt(i).toString()))) {
isfound = true;
}
}
if (!isfound) {
JOptionPane.showMessageDialog(rootPane, "The entered name can not be found. The system is case sensitive!");
} else {
try {
FileReader fileReader3 = new FileReader("DataFiles/Passengers/" + JtxtLoginName.getText() + ".txt");
BufferedReader bufferedReader3 = new BufferedReader(fileReader3);
line3 = bufferedReader3.readLine();
line3 = bufferedReader3.readLine();
Email = line3;
line3 = bufferedReader3.readLine();
String str = this.jPassFieldLogin.getText();
if (line3.equals("Password: " + str)) {
//user inteface setup
File FlightFolder = new File("DataFiles/Flights");
File[] listOfFiles = FlightFolder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isDirectory()) {
jCmboBoxFlightsList.addItem(listOfFiles[i].getName());
}
if (i < listOfFiles.length) {
temp = true;
}
}
this.setVisible(false);
LoggedUser = JtxtLoginName.getText();
this.JtxtLoginName.setText("");
this.jPassFieldLogin.setText("");
this.UserMainDialog.setVisible(true);
UserMainDialog.pack();
JOptionPane.showMessageDialog(rootPane, "Welcome " + LoggedUser, "Welcome", JOptionPane.INFORMATION_MESSAGE);
bufferedReader3.close();
} else {
JOptionPane.showMessageDialog(rootPane, "You entered incurrect password", "Login error", JOptionPane.ERROR_MESSAGE);
}
} catch (IOException ex) {
Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
}
}
}
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
File ExistFolders = new File("");
File[] listOfFiles3;
listOfFiles3 = ExistFolders.listFiles();
//Creating new folders DataFiles , Flights,Passangers,Managers,Orders
// if (listOfFiles3.length==0)
this.jLblCost.setText("");
this.jTxtAreaOrderInfo.setVisible(false);
this.jLblOrders.setVisible(false);
this.jCmboBoxOrdersList.setVisible(false);
this.jScrollPane2.setVisible(false);
this.jCmboBoxPassangers.setVisible(false);
this.jCmboBoxEmails.setVisible(false);
String line = null;
String line2 = null;
try {
FileReader fileReader = new FileReader("DataFiles/Passengers/PassengersList.txt");
FileReader fileReader2 = new FileReader("DataFiles/Passengers/PassengersEmailsList.txt");
BufferedReader bufferedReader = new BufferedReader(fileReader);
BufferedReader bufferedReader2 = new BufferedReader(fileReader2);
while ((line = bufferedReader.readLine()) != null) {
this.jCmboBoxPassangers.addItem(line);
}
while ((line2 = bufferedReader2.readLine()) != null) {
this.jCmboBoxEmails.addItem(line2);
}
bufferedReader.close();
bufferedReader2.close();
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
}
private void JBtmMangLoginActionPerformed(java.awt.event.ActionEvent evt) {
String line4, line5 = null;
String tempstring = null;
String password;
boolean isfound2 = false;
if (JtxtLoginName.getText().equals("") || jPassFieldLogin.getText().equals("")) {
JOptionPane.showMessageDialog(rootPane, "Your login input is missing.");
} else {
boolean isfound = false;
tempstring = JtxtLoginName.getText();
for (int i = 0; i < jCmboBoxPassangers.getItemCount(); i++) {
if ((tempstring.equals(jCmboBoxPassangers.getItemAt(i).toString()))) {
isfound = true;
}
}
if (!isfound) {
JOptionPane.showMessageDialog(rootPane, "The entered name can not be found. The system is case sensitive!");
} else {
try {
FileReader fileReader4 = new FileReader("DataFiles/Passengers/" + JtxtLoginName.getText() + ".txt");
BufferedReader bufferedReader4 = new BufferedReader(fileReader4);
line4 = bufferedReader4.readLine();
line4 = bufferedReader4.readLine();
Email = line4;
line4 = bufferedReader4.readLine();
FileReader fileReader5 = new FileReader("DataFiles/Managers/ManagersList.txt");
BufferedReader bufferedReader5 = new BufferedReader(fileReader5);
String str = this.jPassFieldLogin.getText();
if (line4.equals("Password: " + str)) {
bufferedReader4.close();
while ((line5 = bufferedReader5.readLine()) != null) {
if (line5.equals(JtxtLoginName.getText())) {
isfound2 = true;
}
}
if (isfound2) {
JOptionPane.showMessageDialog(rootPane, "Welcome back " + LoggedUser + "! Logging in as manager", "Logged in as manager", JOptionPane.INFORMATION_MESSAGE);
this.setVisible(false);
LoggedUser = JtxtLoginName.getText();
this.JtxtLoginName.setText("");
this.jPassFieldLogin.setText("");
ManagerMainDialog.setVisible(true);
ManagerMainDialog.pack();
} else {
JOptionPane.showMessageDialog(rootPane, LoggedUser + " You are not in the managers list. Logging in as passenger", "Error logging in as manager", JOptionPane.ERROR_MESSAGE);
this.setVisible(false);
LoggedUser = JtxtLoginName.getText();
this.JtxtLoginName.setText("");
this.jPassFieldLogin.setText("");
this.UserMainDialog.setVisible(true);
UserMainDialog.pack();
}
} else {
JOptionPane.showMessageDialog(rootPane, "You entered incurrect password", "Login error", JOptionPane.ERROR_MESSAGE);
}
bufferedReader5.close();
} catch (IOException ex) {
Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
}
}
}
}
private void jBtnCreateFlightActionPerformed(java.awt.event.ActionEvent evt) {
//names Arrays for name generator
String[] EmployeeFirstName = new String[20];
EmployeeFirstName[1] = "Tyron";
EmployeeFirstName[2] = "Shelley";
EmployeeFirstName[3] = "Charlie";
EmployeeFirstName[4] = "Nikolas";
EmployeeFirstName[5] = "Dwayne";
EmployeeFirstName[6] = "Itamar";
EmployeeFirstName[7] = "Ricky";
EmployeeFirstName[8] = "Richard";
EmployeeFirstName[9] = "Riley";
EmployeeFirstName[10] = "Clinton";
EmployeeFirstName[11] = "Bob";
EmployeeFirstName[12] = "Marshal";
EmployeeFirstName[13] = "Jeffry";
EmployeeFirstName[14] = "Harley";
EmployeeFirstName[15] = "Tylor";
EmployeeFirstName[16] = "Mark";
EmployeeFirstName[17] = "Jack";
EmployeeFirstName[18] = "Alexander ";
EmployeeFirstName[19] = "Daniel";
EmployeeFirstName[0] = "Justin";
String[] EmployeeLastName = new String[20];
EmployeeLastName[0] = "White";
EmployeeLastName[1] = "Gram";
EmployeeLastName[2] = "Barden";
EmployeeLastName[3] = "Hill";
EmployeeLastName[4] = "Tesi";
EmployeeLastName[5] = "Carlli";
EmployeeLastName[6] = "Zee";
EmployeeLastName[7] = "Skouras";
EmployeeLastName[8] = "Edley";
EmployeeLastName[9] = "Dalton";
EmployeeLastName[10] = "Judd";
EmployeeLastName[11] = "Mcneill";
EmployeeLastName[12] = "Ettner";
EmployeeLastName[13] = "Hansen";
EmployeeLastName[14] = "Hime";
EmployeeLastName[15] = "Revlin";
EmployeeLastName[16] = "Keller";
EmployeeLastName[17] = "Rew";
EmployeeLastName[18] = "Griffith";
EmployeeLastName[19] = "Da silva";
String tempString1 = jCmboBoxOrigin.getSelectedItem().toString();
String tempString2 = jCmboBoxDest.getSelectedItem().toString();
int rnd = 0;
if (tempString1.equals(tempString2)) {
JOptionPane.showMessageDialog(rootPane, "Origin and Destination CAN NOT be the same", "Error", JOptionPane.ERROR_MESSAGE);
} else {
try {
//flight generator + folders generators
rnd = (int) ((Math.random() * (999 - 100 + 1)) + 100);
Flight f = new Flight(rnd, jCmboBoxPlaneType.getSelectedItem().toString(), jCmboBoxOrigin.getSelectedItem().toString(), jCmboBoxDest.getSelectedItem().toString());
File FlightDir = new File("DataFiles/Flights/" + rnd);
FlightDir.mkdir();
File AttendantsDir = new File("DataFiles/Flights/" + rnd + "/Attendants");
AttendantsDir.mkdir();
File PilotsDir = new File("DataFiles/Flights/" + rnd + "/Pilots");
PilotsDir.mkdir();
FileWriter fileWriter;
fileWriter = new FileWriter("DataFiles/Flights/" + rnd + "/FlightInformation.txt");
BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
bufferedWriter.write("Flight number: " + rnd);
bufferedWriter.newLine();
bufferedWriter.write("Origin of flight: " + jCmboBoxOrigin.getSelectedItem().toString());
bufferedWriter.newLine();
bufferedWriter.write("Destination of flight: " + jCmboBoxDest.getSelectedItem().toString());
bufferedWriter.newLine();
bufferedWriter.write("Plane Type: " + jCmboBoxPlaneType.getSelectedItem().toString());
bufferedWriter.newLine();
bufferedWriter.close();
//flight number update
String tempLineReader;
int intTempLineReader;
FileReader flightNumberFileReader = new FileReader("DataFiles/Flights/FlightsNumber.txt");
BufferedReader flightNumberBufferedReader = new BufferedReader(flightNumberFileReader);
tempLineReader = flightNumberBufferedReader.readLine();
intTempLineReader = Integer.parseInt(tempLineReader);
intTempLineReader = intTempLineReader + 1;
FileWriter fileWriterNumberOfFlights;
fileWriterNumberOfFlights = new FileWriter("DataFiles/Flights/FlightsNumber.txt");
BufferedWriter bufferedWriterNumberOfFlights = new BufferedWriter(fileWriterNumberOfFlights);
bufferedWriterNumberOfFlights.write(Integer.toString(intTempL
Initial URL
Initial Description
Ultra Flights
Initial Title
Ultra Flights 29.10.13
Initial Tags
Initial Language
Java