Posted By

saaarb97 on 10/30/13


Tagged


Versions (?)

Ultra Flights 29.10.13


 / Published in: Java
 

Ultra Flights

  1. package ultraflightsincapp;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.BufferedWriter;
  5. import java.io.File;
  6. import java.io.FileNotFoundException;
  7. import java.io.FileReader;
  8. import java.io.FileWriter;
  9. import java.io.IOException;
  10. import java.util.logging.Level;
  11. import java.util.logging.Logger;
  12. import java.util.regex.Matcher;
  13. import java.util.regex.Pattern;
  14. import javax.swing.JOptionPane;
  15.  
  16. public class UserInterface extends javax.swing.JFrame {
  17.  
  18. private boolean temp = false;
  19. private int TicketNum;
  20. private String Email = "Temp";
  21. private String LoggedUser;
  22. private boolean Registerd;
  23.  
  24. public UserInterface() {
  25. initComponents();
  26. }
  27.  
  28. @SuppressWarnings("unchecked")
  29. // <editor-fold defaultstate="collapsed" desc="Generated Code">
  30. private void initComponents() {
  31.  
  32. UserMainDialog = new javax.swing.JDialog();
  33. jLabel14 = new javax.swing.JLabel();
  34. jLabel15 = new javax.swing.JLabel();
  35. jCmboBoxFlightsList = new javax.swing.JComboBox();
  36. jScrollPane1 = new javax.swing.JScrollPane();
  37. jTxtAreaInfo = new javax.swing.JTextArea();
  38. jLabel16 = new javax.swing.JLabel();
  39. jLabel17 = new javax.swing.JLabel();
  40. jTxtTicktsNum = new javax.swing.JTextField();
  41. jLblOrders = new javax.swing.JLabel();
  42. jLabel19 = new javax.swing.JLabel();
  43. jCmboBoxOrdersList = new javax.swing.JComboBox();
  44. jScrollPane2 = new javax.swing.JScrollPane();
  45. jTxtAreaOrderInfo = new javax.swing.JTextArea();
  46. jBtnPurchaseTickets = new javax.swing.JButton();
  47. jLabel31 = new javax.swing.JLabel();
  48. jButton2 = new javax.swing.JButton();
  49. jLabel32 = new javax.swing.JLabel();
  50. jLblCost = new javax.swing.JLabel();
  51. ManagerMainDialog = new javax.swing.JDialog();
  52. jLabel1 = new javax.swing.JLabel();
  53. jLabel10 = new javax.swing.JLabel();
  54. jLabel9 = new javax.swing.JLabel();
  55. jLabel11 = new javax.swing.JLabel();
  56. jLabel12 = new javax.swing.JLabel();
  57. jLabel13 = new javax.swing.JLabel();
  58. jCmboBoxOrigin = new javax.swing.JComboBox();
  59. jCmboBoxDest = new javax.swing.JComboBox();
  60. jCmboBoxflightAttendantsNum = new javax.swing.JComboBox();
  61. jCmboBoxPlaneType = new javax.swing.JComboBox();
  62. jBtnCreateFlight = new javax.swing.JButton();
  63. jLabel33 = new javax.swing.JLabel();
  64. jButton3 = new javax.swing.JButton();
  65. PurchaseWindow = new javax.swing.JDialog();
  66. jPanel2 = new javax.swing.JPanel();
  67. jLabel20 = new javax.swing.JLabel();
  68. jLabel21 = new javax.swing.JLabel();
  69. jLabel22 = new javax.swing.JLabel();
  70. jLabel23 = new javax.swing.JLabel();
  71. jCmboBoxMonth = new javax.swing.JComboBox();
  72. jCmboBoxYear = new javax.swing.JComboBox();
  73. jTxtCode = new javax.swing.JTextField();
  74. jTxtCCard = new javax.swing.JTextField();
  75. jLabel24 = new javax.swing.JLabel();
  76. jLabel25 = new javax.swing.JLabel();
  77. jLabel26 = new javax.swing.JLabel();
  78. jTxtBillingName = new javax.swing.JTextField();
  79. jLabel27 = new javax.swing.JLabel();
  80. jTxtCity = new javax.swing.JTextField();
  81. jLabel28 = new javax.swing.JLabel();
  82. jTxtAddress = new javax.swing.JTextField();
  83. jLabel29 = new javax.swing.JLabel();
  84. jTxtZip = new javax.swing.JTextField();
  85. jLabel30 = new javax.swing.JLabel();
  86. jTxtPhone = new javax.swing.JTextField();
  87. jSeparator1 = new javax.swing.JSeparator();
  88. jBtmPurchaseContinue = new javax.swing.JButton();
  89. jLblPayment = new javax.swing.JLabel();
  90. jLblTotalPayment = new javax.swing.JLabel();
  91. jLblTo = new javax.swing.JLabel();
  92. jBtnAccept = new javax.swing.JButton();
  93. jBtnEdit = new javax.swing.JButton();
  94. jScrollPane3 = new javax.swing.JScrollPane();
  95. jTxtAreaBillingInfo = new javax.swing.JTextArea();
  96. jLblName = new javax.swing.JLabel();
  97. jLabel35 = new javax.swing.JLabel();
  98. jButton1 = new javax.swing.JButton();
  99. jPanel1 = new javax.swing.JPanel();
  100. JBtmRegister = new javax.swing.JButton();
  101. JtxtRegistEmail = new javax.swing.JTextField();
  102. jLabel2 = new javax.swing.JLabel();
  103. jLabel3 = new javax.swing.JLabel();
  104. jLabel4 = new javax.swing.JLabel();
  105. jLabel5 = new javax.swing.JLabel();
  106. JtxtLoginName = new javax.swing.JTextField();
  107. JBtmUserLogin = new javax.swing.JButton();
  108. JBtmMangLogin = new javax.swing.JButton();
  109. jLabel6 = new javax.swing.JLabel();
  110. jLabel7 = new javax.swing.JLabel();
  111. jLabel8 = new javax.swing.JLabel();
  112. JTxtName = new javax.swing.JTextField();
  113. jCmboBoxPassangers = new javax.swing.JComboBox();
  114. jCmboBoxEmails = new javax.swing.JComboBox();
  115. jPassFieldRegis = new javax.swing.JPasswordField();
  116. jPassFieldLogin = new javax.swing.JPasswordField();
  117. jLabel36 = new javax.swing.JLabel();
  118. jLabel18 = new javax.swing.JLabel();
  119. jLabel34 = new javax.swing.JLabel();
  120.  
  121. UserMainDialog.setMinimumSize(new java.awt.Dimension(662, 333));
  122. UserMainDialog.setResizable(false);
  123. UserMainDialog.addWindowListener(new java.awt.event.WindowAdapter() {
  124. public void windowActivated(java.awt.event.WindowEvent evt) {
  125. UserMainDialogWindowActivated(evt);
  126. }
  127. public void windowClosed(java.awt.event.WindowEvent evt) {
  128. UserMainDialogWindowClosed(evt);
  129. }
  130. public void windowOpened(java.awt.event.WindowEvent evt) {
  131. UserMainDialogWindowOpened(evt);
  132. }
  133. });
  134.  
  135. jLabel14.setText("purchase flight tickets");
  136.  
  137. jLabel15.setText("Available flights:");
  138.  
  139. jCmboBoxFlightsList.addItemListener(new java.awt.event.ItemListener() {
  140. public void itemStateChanged(java.awt.event.ItemEvent evt) {
  141. jCmboBoxFlightsListItemStateChanged(evt);
  142. }
  143. });
  144. jCmboBoxFlightsList.addActionListener(new java.awt.event.ActionListener() {
  145. public void actionPerformed(java.awt.event.ActionEvent evt) {
  146. jCmboBoxFlightsListActionPerformed(evt);
  147. }
  148. });
  149.  
  150. jTxtAreaInfo.setColumns(20);
  151. jTxtAreaInfo.setRows(5);
  152. jScrollPane1.setViewportView(jTxtAreaInfo);
  153.  
  154. jLabel16.setText("Flight information:");
  155.  
  156. jLabel17.setText("Number of tickets:");
  157.  
  158. jTxtTicktsNum.addKeyListener(new java.awt.event.KeyAdapter() {
  159. public void keyReleased(java.awt.event.KeyEvent evt) {
  160. jTxtTicktsNumKeyReleased(evt);
  161. }
  162. });
  163.  
  164. jLblOrders.setText("Your orders:");
  165.  
  166. jLabel19.setText("Order number:");
  167.  
  168. jCmboBoxOrdersList.setModel(new javax.swing.DefaultComboBoxModel(new String[] { " " }));
  169.  
  170. jTxtAreaOrderInfo.setColumns(20);
  171. jTxtAreaOrderInfo.setRows(5);
  172. jScrollPane2.setViewportView(jTxtAreaOrderInfo);
  173.  
  174. jBtnPurchaseTickets.setText("Continue purchase");
  175. jBtnPurchaseTickets.addActionListener(new java.awt.event.ActionListener() {
  176. public void actionPerformed(java.awt.event.ActionEvent evt) {
  177. jBtnPurchaseTicketsActionPerformed(evt);
  178. }
  179. });
  180.  
  181. jLabel31.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
  182. jLabel31.setText("Ultra Flights Inc.");
  183. jLabel31.setVerticalAlignment(javax.swing.SwingConstants.TOP);
  184. jLabel31.setDoubleBuffered(true);
  185.  
  186. jButton2.setText("Back");
  187. jButton2.addActionListener(new java.awt.event.ActionListener() {
  188. public void actionPerformed(java.awt.event.ActionEvent evt) {
  189. jButton2ActionPerformed(evt);
  190. }
  191. });
  192.  
  193. jLabel32.setText("Will cost:");
  194.  
  195. jLblCost.setText("*********");
  196.  
  197. javax.swing.GroupLayout UserMainDialogLayout = new javax.swing.GroupLayout(UserMainDialog.getContentPane());
  198. UserMainDialog.getContentPane().setLayout(UserMainDialogLayout);
  199. UserMainDialogLayout.setHorizontalGroup(
  200. UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  201. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, UserMainDialogLayout.createSequentialGroup()
  202. .addContainerGap(478, Short.MAX_VALUE)
  203. .addComponent(jLblOrders)
  204. .addGap(124, 124, 124))
  205. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, UserMainDialogLayout.createSequentialGroup()
  206. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  207. .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 269, javax.swing.GroupLayout.PREFERRED_SIZE)
  208. .addComponent(jLabel16)
  209. .addGroup(UserMainDialogLayout.createSequentialGroup()
  210. .addComponent(jLabel17)
  211. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  212. .addComponent(jTxtTicktsNum, javax.swing.GroupLayout.PREFERRED_SIZE, 33, javax.swing.GroupLayout.PREFERRED_SIZE)
  213. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  214. .addComponent(jLabel32)
  215. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  216. .addComponent(jLblCost))
  217. .addGroup(UserMainDialogLayout.createSequentialGroup()
  218. .addComponent(jLabel15)
  219. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  220. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  221. .addComponent(jLabel14)
  222. .addComponent(jCmboBoxFlightsList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
  223. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 128, Short.MAX_VALUE)
  224. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  225. .addGroup(javax.swing.GroupLayout.Alignment.LEADING, UserMainDialogLayout.createSequentialGroup()
  226. .addComponent(jLabel19)
  227. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  228. .addComponent(jCmboBoxOrdersList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  229. .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE))
  230. .addContainerGap())
  231. .addGroup(UserMainDialogLayout.createSequentialGroup()
  232. .addGap(38, 38, 38)
  233. .addComponent(jBtnPurchaseTickets)
  234. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 446, Short.MAX_VALUE)
  235. .addComponent(jButton2))
  236. .addGroup(UserMainDialogLayout.createSequentialGroup()
  237. .addGap(279, 279, 279)
  238. .addComponent(jLabel31))
  239. );
  240. UserMainDialogLayout.setVerticalGroup(
  241. UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  242. .addGroup(UserMainDialogLayout.createSequentialGroup()
  243. .addComponent(jLabel31)
  244. .addGap(18, 18, 18)
  245. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  246. .addComponent(jLblOrders)
  247. .addComponent(jLabel14))
  248. .addGap(33, 33, 33)
  249. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  250. .addComponent(jLabel15)
  251. .addComponent(jCmboBoxFlightsList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  252. .addComponent(jLabel19)
  253. .addComponent(jCmboBoxOrdersList, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  254. .addGap(20, 20, 20)
  255. .addComponent(jLabel16)
  256. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  257. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  258. .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
  259. .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE))
  260. .addGap(27, 27, 27)
  261. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  262. .addComponent(jButton2)
  263. .addGroup(UserMainDialogLayout.createSequentialGroup()
  264. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  265. .addComponent(jTxtTicktsNum, javax.swing.GroupLayout.Alignment.TRAILING)
  266. .addGroup(UserMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  267. .addComponent(jLabel17)
  268. .addComponent(jLabel32)
  269. .addComponent(jLblCost)))
  270. .addGap(31, 31, 31)
  271. .addComponent(jBtnPurchaseTickets)
  272. .addContainerGap())))
  273. );
  274.  
  275. ManagerMainDialog.addWindowListener(new java.awt.event.WindowAdapter() {
  276. public void windowClosed(java.awt.event.WindowEvent evt) {
  277. ManagerMainDialogWindowClosed(evt);
  278. }
  279. });
  280.  
  281. jLabel1.setText("Managers console - if you are not a managr please relog.");
  282.  
  283. jLabel10.setFont(new java.awt.Font("Arial Black", 1, 14)); // NOI18N
  284. jLabel10.setText("Flight route creation");
  285.  
  286. jLabel9.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
  287. jLabel9.setText("Origin of flight:");
  288.  
  289. jLabel11.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
  290. jLabel11.setText("Destination of flight:");
  291.  
  292. jLabel12.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
  293. jLabel12.setText("Number of flight attendants:");
  294.  
  295. jLabel13.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
  296. jLabel13.setText("Plane type:");
  297.  
  298. 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", " " }));
  299.  
  300. 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" }));
  301.  
  302. jCmboBoxflightAttendantsNum.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "2", "3", "4", "5", "6", "7", "8", "9", "10" }));
  303.  
  304. jCmboBoxPlaneType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Boeing 737-900ER", "Boeing 747-400", "Boeing 767-300ER", "Boeing 737-800" }));
  305.  
  306. jBtnCreateFlight.setText("Create flight");
  307. jBtnCreateFlight.addActionListener(new java.awt.event.ActionListener() {
  308. public void actionPerformed(java.awt.event.ActionEvent evt) {
  309. jBtnCreateFlightActionPerformed(evt);
  310. }
  311. });
  312.  
  313. jLabel33.setText("Ultra Flights Inc.");
  314.  
  315. jButton3.setText("Back");
  316. jButton3.addActionListener(new java.awt.event.ActionListener() {
  317. public void actionPerformed(java.awt.event.ActionEvent evt) {
  318. jButton3ActionPerformed(evt);
  319. }
  320. });
  321.  
  322. javax.swing.GroupLayout ManagerMainDialogLayout = new javax.swing.GroupLayout(ManagerMainDialog.getContentPane());
  323. ManagerMainDialog.getContentPane().setLayout(ManagerMainDialogLayout);
  324. ManagerMainDialogLayout.setHorizontalGroup(
  325. ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  326. .addGroup(ManagerMainDialogLayout.createSequentialGroup()
  327. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  328. .addGroup(ManagerMainDialogLayout.createSequentialGroup()
  329. .addComponent(jLabel1)
  330. .addGap(56, 56, 56)
  331. .addComponent(jLabel33))
  332. .addGroup(ManagerMainDialogLayout.createSequentialGroup()
  333. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  334. .addComponent(jLabel12)
  335. .addComponent(jLabel11)
  336. .addComponent(jLabel9)
  337. .addComponent(jLabel13)
  338. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ManagerMainDialogLayout.createSequentialGroup()
  339. .addContainerGap()
  340. .addComponent(jBtnCreateFlight)))
  341. .addGap(10, 10, 10)
  342. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  343. .addComponent(jCmboBoxPlaneType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  344. .addComponent(jCmboBoxOrigin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  345. .addComponent(jCmboBoxflightAttendantsNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  346. .addComponent(jCmboBoxDest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  347. .addGroup(ManagerMainDialogLayout.createSequentialGroup()
  348. .addGap(45, 45, 45)
  349. .addComponent(jLabel10)))
  350. .addContainerGap(245, Short.MAX_VALUE))
  351. .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, ManagerMainDialogLayout.createSequentialGroup()
  352. .addContainerGap(599, Short.MAX_VALUE)
  353. .addComponent(jButton3))
  354. );
  355. ManagerMainDialogLayout.setVerticalGroup(
  356. ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  357. .addGroup(ManagerMainDialogLayout.createSequentialGroup()
  358. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  359. .addComponent(jLabel1)
  360. .addComponent(jLabel33))
  361. .addGap(18, 18, 18)
  362. .addComponent(jLabel10)
  363. .addGap(35, 35, 35)
  364. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  365. .addComponent(jLabel9)
  366. .addComponent(jCmboBoxOrigin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  367. .addGap(21, 21, 21)
  368. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  369. .addComponent(jLabel11)
  370. .addComponent(jCmboBoxDest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  371. .addGap(18, 18, 18)
  372. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  373. .addComponent(jLabel12)
  374. .addComponent(jCmboBoxflightAttendantsNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  375. .addGap(18, 18, 18)
  376. .addGroup(ManagerMainDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  377. .addComponent(jLabel13)
  378. .addComponent(jCmboBoxPlaneType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  379. .addGap(26, 26, 26)
  380. .addComponent(jBtnCreateFlight)
  381. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
  382. .addComponent(jButton3))
  383. );
  384.  
  385. PurchaseWindow.setMinimumSize(new java.awt.Dimension(662, 333));
  386. PurchaseWindow.addWindowListener(new java.awt.event.WindowAdapter() {
  387. public void windowClosed(java.awt.event.WindowEvent evt) {
  388. PurchaseWindowWindowClosed(evt);
  389. }
  390. public void windowOpened(java.awt.event.WindowEvent evt) {
  391. PurchaseWindowWindowOpened(evt);
  392. }
  393. });
  394.  
  395. jPanel2.setPreferredSize(new java.awt.Dimension(662, 333));
  396.  
  397. jLabel20.setText("Purchase tickets");
  398.  
  399. jLabel21.setText("We accept the following secure payment methods: Visa , MasterCard and American Express");
  400.  
  401. jLabel22.setText("Card number");
  402.  
  403. jLabel23.setText("Expiration date and security code");
  404.  
  405. jCmboBoxMonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));
  406.  
  407. jCmboBoxYear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "----", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025" }));
  408.  
  409. jLabel24.setText("Payment information");
  410.  
  411. jLabel25.setText("Billing information");
  412.  
  413. jLabel26.setText("Name:");
  414.  
  415. jTxtBillingName.setEnabled(false);
  416.  
  417. jLabel27.setText("City");
  418.  
  419. jLabel28.setText("Billing address");
  420.  
  421. jLabel29.setText("Zip or postal code");
  422.  
  423. jLabel30.setText("Phone number");
  424.  
  425. jSeparator1.setBackground(new java.awt.Color(0, 0, 0));
  426. jSeparator1.setForeground(new java.awt.Color(0, 0, 0));
  427. jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
  428.  
  429. jBtmPurchaseContinue.setText("Continue");
  430. jBtmPurchaseContinue.addActionListener(new java.awt.event.ActionListener() {
  431. public void actionPerformed(java.awt.event.ActionEvent evt) {
  432. jBtmPurchaseContinueActionPerformed(evt);
  433. }
  434. });
  435.  
  436. jLblPayment.setText("Total payment:");
  437.  
  438. jLblTotalPayment.setText("*******");
  439.  
  440. jLblTo.setText("To:");
  441.  
  442. jBtnAccept.setText("Accept");
  443. jBtnAccept.addActionListener(new java.awt.event.ActionListener() {
  444. public void actionPerformed(java.awt.event.ActionEvent evt) {
  445. jBtnAcceptActionPerformed(evt);
  446. }
  447. });
  448.  
  449. jBtnEdit.setText("Edit");
  450. jBtnEdit.addActionListener(new java.awt.event.ActionListener() {
  451. public void actionPerformed(java.awt.event.ActionEvent evt) {
  452. jBtnEditActionPerformed(evt);
  453. }
  454. });
  455.  
  456. jTxtAreaBillingInfo.setColumns(20);
  457. jTxtAreaBillingInfo.setRows(5);
  458. jScrollPane3.setViewportView(jTxtAreaBillingInfo);
  459.  
  460. jLblName.setText("*******");
  461.  
  462. jLabel35.setText("Ultra Flights Inc.");
  463.  
  464. jButton1.setText("Back");
  465. jButton1.addActionListener(new java.awt.event.ActionListener() {
  466. public void actionPerformed(java.awt.event.ActionEvent evt) {
  467. jButton1ActionPerformed(evt);
  468. }
  469. });
  470.  
  471. javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
  472. jPanel2.setLayout(jPanel2Layout);
  473. jPanel2Layout.setHorizontalGroup(
  474. jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  475. .addGroup(jPanel2Layout.createSequentialGroup()
  476. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  477. .addGroup(jPanel2Layout.createSequentialGroup()
  478. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  479. .addComponent(jLabel21)
  480. .addComponent(jLabel24)
  481. .addComponent(jLabel25)
  482. .addComponent(jLabel30)
  483. .addGroup(jPanel2Layout.createSequentialGroup()
  484. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  485. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  486. .addComponent(jTxtAddress, javax.swing.GroupLayout.DEFAULT_SIZE, 181, Short.MAX_VALUE)
  487. .addComponent(jLabel22, javax.swing.GroupLayout.Alignment.LEADING)
  488. .addComponent(jTxtCCard)
  489. .addComponent(jLabel26, javax.swing.GroupLayout.Alignment.LEADING)
  490. .addComponent(jTxtBillingName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 143, javax.swing.GroupLayout.PREFERRED_SIZE)
  491. .addComponent(jLabel28, javax.swing.GroupLayout.Alignment.LEADING))
  492. .addComponent(jTxtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
  493. .addGap(125, 125, 125)
  494. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  495. .addComponent(jBtmPurchaseContinue)
  496. .addComponent(jTxtCity, javax.swing.GroupLayout.PREFERRED_SIZE, 142, javax.swing.GroupLayout.PREFERRED_SIZE)
  497. .addComponent(jTxtZip, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE)
  498. .addComponent(jLabel29)
  499. .addGroup(jPanel2Layout.createSequentialGroup()
  500. .addComponent(jCmboBoxMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  501. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  502. .addComponent(jCmboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  503. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  504. .addComponent(jTxtCode, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
  505. .addComponent(jLabel23)
  506. .addComponent(jLabel27))))
  507. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
  508. .addGroup(jPanel2Layout.createSequentialGroup()
  509. .addContainerGap()
  510. .addComponent(jLabel20)
  511. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  512. .addComponent(jLabel35)
  513. .addGap(135, 135, 135)))
  514. .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  515. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  516. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  517. .addGroup(jPanel2Layout.createSequentialGroup()
  518. .addGap(0, 12, Short.MAX_VALUE)
  519. .addComponent(jBtnAccept)
  520. .addGap(18, 18, 18)
  521. .addComponent(jBtnEdit, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)
  522. .addGap(23, 23, 23))
  523. .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
  524. .addComponent(jLblPayment)
  525. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  526. .addComponent(jLblTotalPayment, javax.swing.GroupLayout.DEFAULT_SIZE, 94, Short.MAX_VALUE)
  527. .addContainerGap())
  528. .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
  529. .addComponent(jLblTo)
  530. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  531. .addComponent(jLblName, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE)
  532. .addContainerGap())
  533. .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
  534. .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)
  535. .addContainerGap())
  536. .addComponent(jButton1)))
  537. );
  538. jPanel2Layout.setVerticalGroup(
  539. jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  540. .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE)
  541. .addGroup(jPanel2Layout.createSequentialGroup()
  542. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  543. .addGroup(jPanel2Layout.createSequentialGroup()
  544. .addGap(9, 9, 9)
  545. .addComponent(jLabel20))
  546. .addComponent(jLabel35))
  547. .addGap(14, 14, 14)
  548. .addComponent(jLabel24)
  549. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  550. .addComponent(jLabel21)
  551. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  552. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  553. .addComponent(jLabel23, javax.swing.GroupLayout.Alignment.TRAILING)
  554. .addComponent(jLabel22))
  555. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  556. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  557. .addComponent(jTxtCCard, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  558. .addComponent(jCmboBoxMonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  559. .addComponent(jCmboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  560. .addComponent(jTxtCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  561. .addGap(18, 18, 18)
  562. .addComponent(jLabel25)
  563. .addGap(18, 18, 18)
  564. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  565. .addComponent(jLabel26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  566. .addComponent(jLabel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  567. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  568. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  569. .addComponent(jTxtBillingName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  570. .addComponent(jTxtCity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  571. .addGap(18, 18, 18)
  572. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  573. .addComponent(jLabel28)
  574. .addComponent(jLabel29))
  575. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  576. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  577. .addComponent(jTxtAddress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  578. .addComponent(jTxtZip, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  579. .addGap(18, 18, 18)
  580. .addComponent(jLabel30)
  581. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  582. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  583. .addComponent(jTxtPhone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  584. .addComponent(jBtmPurchaseContinue))
  585. .addGap(0, 2, Short.MAX_VALUE))
  586. .addGroup(jPanel2Layout.createSequentialGroup()
  587. .addGap(47, 47, 47)
  588. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  589. .addComponent(jLblPayment)
  590. .addComponent(jLblTotalPayment, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
  591. .addGap(18, 18, 18)
  592. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  593. .addComponent(jLblTo)
  594. .addComponent(jLblName))
  595. .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  596. .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 141, Short.MAX_VALUE)
  597. .addGap(18, 18, 18)
  598. .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  599. .addComponent(jBtnAccept)
  600. .addComponent(jBtnEdit))
  601. .addGap(29, 29, 29)
  602. .addComponent(jButton1))
  603. );
  604.  
  605. javax.swing.GroupLayout PurchaseWindowLayout = new javax.swing.GroupLayout(PurchaseWindow.getContentPane());
  606. PurchaseWindow.getContentPane().setLayout(PurchaseWindowLayout);
  607. PurchaseWindowLayout.setHorizontalGroup(
  608. PurchaseWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  609. .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  610. );
  611. PurchaseWindowLayout.setVerticalGroup(
  612. PurchaseWindowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  613. .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  614. );
  615.  
  616. setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  617. addWindowListener(new java.awt.event.WindowAdapter() {
  618. public void windowClosed(java.awt.event.WindowEvent evt) {
  619. formWindowClosed(evt);
  620. }
  621. public void windowOpened(java.awt.event.WindowEvent evt) {
  622. formWindowOpened(evt);
  623. }
  624. });
  625.  
  626. jPanel1.setMaximumSize(new java.awt.Dimension(662, 333));
  627. jPanel1.setMinimumSize(new java.awt.Dimension(662, 333));
  628.  
  629. JBtmRegister.setText("Register");
  630. JBtmRegister.addActionListener(new java.awt.event.ActionListener() {
  631. public void actionPerformed(java.awt.event.ActionEvent evt) {
  632. JBtmRegisterActionPerformed(evt);
  633. }
  634. });
  635.  
  636. jLabel2.setText("Email address:");
  637.  
  638. jLabel3.setText("Password:");
  639.  
  640. jLabel4.setText("First and last name:");
  641.  
  642. jLabel5.setText("Password:");
  643.  
  644. JBtmUserLogin.setText("User login");
  645. JBtmUserLogin.addActionListener(new java.awt.event.ActionListener() {
  646. public void actionPerformed(java.awt.event.ActionEvent evt) {
  647. JBtmUserLoginActionPerformed(evt);
  648. }
  649. });
  650.  
  651. JBtmMangLogin.setText("Manager login");
  652. JBtmMangLogin.addActionListener(new java.awt.event.ActionListener() {
  653. public void actionPerformed(java.awt.event.ActionEvent evt) {
  654. JBtmMangLoginActionPerformed(evt);
  655. }
  656. });
  657.  
  658. jLabel6.setText("User/Admin login");
  659.  
  660. jLabel7.setText("Register");
  661.  
  662. jLabel8.setText("First and last name:");
  663.  
  664. jLabel36.setText("Ultra Flights Inc.");
  665.  
  666. jLabel18.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
  667. jLabel18.setText("*Case sesitive");
  668.  
  669. jLabel34.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
  670. jLabel34.setText("*Case sesitive");
  671.  
  672. javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  673. jPanel1.setLayout(jPanel1Layout);
  674. jPanel1Layout.setHorizontalGroup(
  675. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  676. .addGroup(jPanel1Layout.createSequentialGroup()
  677. .addGap(311, 311, 311)
  678. .addComponent(jLabel36))
  679. .addGroup(jPanel1Layout.createSequentialGroup()
  680. .addGap(294, 294, 294)
  681. .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE)
  682. .addGap(34, 34, 34)
  683. .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 153, javax.swing.GroupLayout.PREFERRED_SIZE))
  684. .addGroup(jPanel1Layout.createSequentialGroup()
  685. .addGap(100, 100, 100)
  686. .addComponent(jLabel34, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
  687. .addGap(304, 304, 304)
  688. .addComponent(jLabel18, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
  689. .addGroup(jPanel1Layout.createSequentialGroup()
  690. .addComponent(jLabel8)
  691. .addGap(5, 5, 5)
  692. .addComponent(JTxtName, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
  693. .addGap(110, 110, 110)
  694. .addComponent(jLabel4)
  695. .addGap(5, 5, 5)
  696. .addComponent(JtxtLoginName, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
  697. .addGroup(jPanel1Layout.createSequentialGroup()
  698. .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
  699. .addGap(10, 10, 10)
  700. .addComponent(JtxtRegistEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 160, javax.swing.GroupLayout.PREFERRED_SIZE)
  701. .addGap(110, 110, 110)
  702. .addComponent(jLabel5)
  703. .addGap(50, 50, 50)
  704. .addComponent(jPassFieldLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 188, javax.swing.GroupLayout.PREFERRED_SIZE))
  705. .addGroup(jPanel1Layout.createSequentialGroup()
  706. .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
  707. .addGap(10, 10, 10)
  708. .addComponent(jPassFieldRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))
  709. .addGroup(jPanel1Layout.createSequentialGroup()
  710. .addGap(140, 140, 140)
  711. .addComponent(JBtmRegister)
  712. .addGap(257, 257, 257)
  713. .addComponent(JBtmUserLogin)
  714. .addGap(11, 11, 11)
  715. .addComponent(JBtmMangLogin))
  716. .addGroup(jPanel1Layout.createSequentialGroup()
  717. .addGap(10, 10, 10)
  718. .addComponent(jCmboBoxPassangers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  719. .addGap(6, 6, 6)
  720. .addComponent(jCmboBoxEmails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  721. );
  722. jPanel1Layout.setVerticalGroup(
  723. jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  724. .addGroup(jPanel1Layout.createSequentialGroup()
  725. .addComponent(jLabel36)
  726. .addGap(5, 5, 5)
  727. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  728. .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
  729. .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE))
  730. .addGap(14, 14, 14)
  731. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  732. .addComponent(jLabel34)
  733. .addGroup(jPanel1Layout.createSequentialGroup()
  734. .addGap(4, 4, 4)
  735. .addComponent(jLabel18)))
  736. .addGap(3, 3, 3)
  737. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  738. .addGroup(jPanel1Layout.createSequentialGroup()
  739. .addGap(6, 6, 6)
  740. .addComponent(jLabel8))
  741. .addComponent(JTxtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  742. .addComponent(jLabel4)
  743. .addComponent(JtxtLoginName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  744. .addGap(20, 20, 20)
  745. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  746. .addComponent(jLabel2)
  747. .addComponent(JtxtRegistEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  748. .addGroup(jPanel1Layout.createSequentialGroup()
  749. .addGap(10, 10, 10)
  750. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  751. .addComponent(jLabel5)
  752. .addComponent(jPassFieldLogin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
  753. .addGap(10, 10, 10)
  754. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  755. .addComponent(jLabel3)
  756. .addComponent(jPassFieldRegis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  757. .addGap(20, 20, 20)
  758. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  759. .addComponent(JBtmRegister)
  760. .addComponent(JBtmUserLogin)
  761. .addComponent(JBtmMangLogin))
  762. .addGap(9, 9, 9)
  763. .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  764. .addComponent(jCmboBoxPassangers, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  765. .addComponent(jCmboBoxEmails, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
  766. );
  767.  
  768. javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  769. getContentPane().setLayout(layout);
  770. layout.setHorizontalGroup(
  771. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  772. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  773. );
  774. layout.setVerticalGroup(
  775. layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  776. .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  777. );
  778.  
  779. pack();
  780. }// </editor-fold>
  781.  
  782. private void JBtmRegisterActionPerformed(java.awt.event.ActionEvent evt) {
  783. String tempString2 = null, tempString = null;
  784.  
  785.  
  786. Pattern p1 = Pattern.compile("@");
  787. Matcher m1 = p1.matcher(this.JtxtRegistEmail.getText());
  788.  
  789. Pattern p2 = Pattern.compile(".com");
  790. Matcher m2 = p2.matcher(this.JtxtRegistEmail.getText());
  791.  
  792. Pattern p3 = Pattern.compile(" ");
  793. Matcher m3 = p3.matcher(this.JTxtName.getText());
  794.  
  795.  
  796.  
  797.  
  798. if (this.JtxtRegistEmail.getText().equals("") || this.jPassFieldRegis.getText().equals("") || this.JTxtName.getText().equals("")) {
  799. JOptionPane.showMessageDialog(this, "Must enter Email and password");
  800. } else if (!m1.find() || !m2.find()) {
  801. JOptionPane.showMessageDialog(rootPane, "Must enter a valid Email");
  802. } else if (!m3.find()) {
  803. JOptionPane.showMessageDialog(rootPane, "Must enter first name AND last name");
  804. } else {
  805. tempString = this.JTxtName.getText();
  806.  
  807. for (int i1 = 0; i1 < this.jCmboBoxPassangers.getItemCount(); i1++) {
  808. if (tempString.equals(this.jCmboBoxPassangers.getItemAt(i1).toString())) {
  809. JOptionPane.showMessageDialog(rootPane, "Name already in use");
  810. } else {
  811. tempString2 = this.JTxtName.getText();
  812. }
  813. }
  814. for (int i2 = 0; i2 < this.jCmboBoxPassangers.getItemCount(); i2++) {
  815. if (tempString2.equals(this.jCmboBoxEmails.getItemAt(i2).toString())) {
  816. JOptionPane.showMessageDialog(rootPane, "Email already in use");
  817. } else {
  818. if (Registerd = false) {
  819. String filename = this.JTxtName.getText();
  820. FileWriter fileWriter;
  821. FileWriter fileWriter2;
  822. FileWriter fileWriter3;
  823. try {
  824. fileWriter = new FileWriter("DataFiles/Passengers/" + filename + ".txt", true);
  825. fileWriter2 = new FileWriter("DataFiles/Passengers/PassengersList.txt", true);
  826. fileWriter3 = new FileWriter("DataFiles/Passengers/PassengersEmailsList.txt", true);
  827. BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
  828.  
  829. bufferedWriter.write("Name: " + filename);
  830. bufferedWriter.newLine();
  831. bufferedWriter.write("Email: " + this.JtxtRegistEmail.getText());
  832. bufferedWriter.newLine();
  833. bufferedWriter.write("Password: " + this.jPassFieldRegis.getText());
  834. bufferedWriter.newLine();
  835.  
  836. BufferedWriter bufferedWriter2 = new BufferedWriter(fileWriter2);
  837. bufferedWriter2.write(filename);
  838. bufferedWriter2.newLine();
  839. bufferedWriter.close();
  840. bufferedWriter2.close();
  841.  
  842. BufferedWriter bufferedWriter3 = new BufferedWriter(fileWriter3);
  843. bufferedWriter3.write(this.JtxtRegistEmail.getText());
  844. bufferedWriter3.newLine();
  845. bufferedWriter3.close();
  846.  
  847. jCmboBoxPassangers.addItem(filename);
  848. jCmboBoxEmails.addItem(this.JtxtRegistEmail);
  849. Registerd = true;
  850. JOptionPane.showMessageDialog(rootPane, "Thank you for registering to Ultra Flights Application " + filename + "!");
  851. this.JtxtRegistEmail.setText("");
  852. this.jPassFieldRegis.setText("");
  853. this.JTxtName.setText("");
  854.  
  855. this.setVisible(false);
  856. UserMainDialog.setVisible(true);
  857. UserMainDialog.pack();
  858.  
  859. } catch (IOException ex) {
  860. Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
  861. JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
  862. }
  863. }
  864. }
  865. }
  866.  
  867. }
  868.  
  869. }
  870.  
  871. private void JBtmUserLoginActionPerformed(java.awt.event.ActionEvent evt) {
  872. String line3 = null;
  873. String tempstring = null;
  874. String password;
  875. if (JtxtLoginName.getText().equals("") || jPassFieldLogin.getText().equals("")) {
  876. JOptionPane.showMessageDialog(rootPane, "Your login input is missing.");
  877. } else {
  878. boolean isfound = false;
  879.  
  880. tempstring = JtxtLoginName.getText();
  881. for (int i = 0; i < jCmboBoxPassangers.getItemCount(); i++) {
  882. if ((tempstring.equals(jCmboBoxPassangers.getItemAt(i).toString()))) {
  883. isfound = true;
  884.  
  885. }
  886. }
  887. if (!isfound) {
  888. JOptionPane.showMessageDialog(rootPane, "The entered name can not be found. The system is case sensitive!");
  889. } else {
  890. try {
  891. FileReader fileReader3 = new FileReader("DataFiles/Passengers/" + JtxtLoginName.getText() + ".txt");
  892. BufferedReader bufferedReader3 = new BufferedReader(fileReader3);
  893. line3 = bufferedReader3.readLine();
  894. line3 = bufferedReader3.readLine();
  895. Email = line3;
  896. line3 = bufferedReader3.readLine();
  897. String str = this.jPassFieldLogin.getText();
  898. if (line3.equals("Password: " + str)) {
  899. //user inteface setup
  900.  
  901. File FlightFolder = new File("DataFiles/Flights");
  902. File[] listOfFiles = FlightFolder.listFiles();
  903.  
  904. for (int i = 0; i < listOfFiles.length; i++) {
  905.  
  906. if (listOfFiles[i].isDirectory()) {
  907. jCmboBoxFlightsList.addItem(listOfFiles[i].getName());
  908.  
  909. }
  910. if (i < listOfFiles.length) {
  911. temp = true;
  912.  
  913. }
  914. }
  915.  
  916. this.setVisible(false);
  917. LoggedUser = JtxtLoginName.getText();
  918. this.JtxtLoginName.setText("");
  919. this.jPassFieldLogin.setText("");
  920. this.UserMainDialog.setVisible(true);
  921. UserMainDialog.pack();
  922.  
  923. JOptionPane.showMessageDialog(rootPane, "Welcome " + LoggedUser, "Welcome", JOptionPane.INFORMATION_MESSAGE);
  924.  
  925. bufferedReader3.close();
  926. } else {
  927. JOptionPane.showMessageDialog(rootPane, "You entered incurrect password", "Login error", JOptionPane.ERROR_MESSAGE);
  928. }
  929. } catch (IOException ex) {
  930. Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
  931. JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
  932. }
  933.  
  934.  
  935.  
  936. }
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945. }
  946. }
  947.  
  948. private void formWindowOpened(java.awt.event.WindowEvent evt) {
  949.  
  950. File ExistFolders = new File("");
  951. File[] listOfFiles3;
  952. listOfFiles3 = ExistFolders.listFiles();
  953. //Creating new folders DataFiles , Flights,Passangers,Managers,Orders
  954. // if (listOfFiles3.length==0)
  955.  
  956.  
  957.  
  958. this.jLblCost.setText("");
  959. this.jTxtAreaOrderInfo.setVisible(false);
  960. this.jLblOrders.setVisible(false);
  961. this.jCmboBoxOrdersList.setVisible(false);
  962. this.jScrollPane2.setVisible(false);
  963.  
  964. this.jCmboBoxPassangers.setVisible(false);
  965. this.jCmboBoxEmails.setVisible(false);
  966. String line = null;
  967. String line2 = null;
  968. try {
  969. FileReader fileReader = new FileReader("DataFiles/Passengers/PassengersList.txt");
  970. FileReader fileReader2 = new FileReader("DataFiles/Passengers/PassengersEmailsList.txt");
  971. BufferedReader bufferedReader = new BufferedReader(fileReader);
  972. BufferedReader bufferedReader2 = new BufferedReader(fileReader2);
  973.  
  974. while ((line = bufferedReader.readLine()) != null) {
  975.  
  976. this.jCmboBoxPassangers.addItem(line);
  977. }
  978. while ((line2 = bufferedReader2.readLine()) != null) {
  979.  
  980. this.jCmboBoxEmails.addItem(line2);
  981. }
  982. bufferedReader.close();
  983. bufferedReader2.close();
  984. } catch (Exception ex) {
  985. System.out.println(ex.getMessage());
  986. }
  987.  
  988.  
  989.  
  990.  
  991. }
  992.  
  993. private void JBtmMangLoginActionPerformed(java.awt.event.ActionEvent evt) {
  994. String line4, line5 = null;
  995. String tempstring = null;
  996. String password;
  997. boolean isfound2 = false;
  998. if (JtxtLoginName.getText().equals("") || jPassFieldLogin.getText().equals("")) {
  999. JOptionPane.showMessageDialog(rootPane, "Your login input is missing.");
  1000. } else {
  1001. boolean isfound = false;
  1002.  
  1003. tempstring = JtxtLoginName.getText();
  1004. for (int i = 0; i < jCmboBoxPassangers.getItemCount(); i++) {
  1005. if ((tempstring.equals(jCmboBoxPassangers.getItemAt(i).toString()))) {
  1006. isfound = true;
  1007.  
  1008. }
  1009. }
  1010. if (!isfound) {
  1011. JOptionPane.showMessageDialog(rootPane, "The entered name can not be found. The system is case sensitive!");
  1012. } else {
  1013. try {
  1014. FileReader fileReader4 = new FileReader("DataFiles/Passengers/" + JtxtLoginName.getText() + ".txt");
  1015. BufferedReader bufferedReader4 = new BufferedReader(fileReader4);
  1016. line4 = bufferedReader4.readLine();
  1017. line4 = bufferedReader4.readLine();
  1018. Email = line4;
  1019. line4 = bufferedReader4.readLine();
  1020.  
  1021. FileReader fileReader5 = new FileReader("DataFiles/Managers/ManagersList.txt");
  1022. BufferedReader bufferedReader5 = new BufferedReader(fileReader5);
  1023.  
  1024.  
  1025. String str = this.jPassFieldLogin.getText();
  1026. if (line4.equals("Password: " + str)) {
  1027. bufferedReader4.close();
  1028.  
  1029. while ((line5 = bufferedReader5.readLine()) != null) {
  1030. if (line5.equals(JtxtLoginName.getText())) {
  1031. isfound2 = true;
  1032. }
  1033. }
  1034.  
  1035. if (isfound2) {
  1036. JOptionPane.showMessageDialog(rootPane, "Welcome back " + LoggedUser + "! Logging in as manager", "Logged in as manager", JOptionPane.INFORMATION_MESSAGE);
  1037. this.setVisible(false);
  1038. LoggedUser = JtxtLoginName.getText();
  1039. this.JtxtLoginName.setText("");
  1040. this.jPassFieldLogin.setText("");
  1041. ManagerMainDialog.setVisible(true);
  1042. ManagerMainDialog.pack();
  1043.  
  1044.  
  1045.  
  1046. } else {
  1047. JOptionPane.showMessageDialog(rootPane, LoggedUser + " You are not in the managers list. Logging in as passenger", "Error logging in as manager", JOptionPane.ERROR_MESSAGE);
  1048. this.setVisible(false);
  1049. LoggedUser = JtxtLoginName.getText();
  1050. this.JtxtLoginName.setText("");
  1051. this.jPassFieldLogin.setText("");
  1052. this.UserMainDialog.setVisible(true);
  1053. UserMainDialog.pack();
  1054.  
  1055. }
  1056. } else {
  1057. JOptionPane.showMessageDialog(rootPane, "You entered incurrect password", "Login error", JOptionPane.ERROR_MESSAGE);
  1058. }
  1059.  
  1060. bufferedReader5.close();
  1061.  
  1062. } catch (IOException ex) {
  1063. Logger.getLogger(UserInterface.class.getName()).log(Level.SEVERE, null, ex);
  1064. JOptionPane.showMessageDialog(rootPane, "Program Error", "ERROR", JOptionPane.ERROR_MESSAGE);
  1065. }
  1066.  
  1067.  
  1068. }
  1069. }
  1070. }
  1071.  
  1072. private void jBtnCreateFlightActionPerformed(java.awt.event.ActionEvent evt) {
  1073. //names Arrays for name generator
  1074. String[] EmployeeFirstName = new String[20];
  1075.  
  1076. EmployeeFirstName[1] = "Tyron";
  1077. EmployeeFirstName[2] = "Shelley";
  1078. EmployeeFirstName[3] = "Charlie";
  1079. EmployeeFirstName[4] = "Nikolas";
  1080. EmployeeFirstName[5] = "Dwayne";
  1081. EmployeeFirstName[6] = "Itamar";
  1082. EmployeeFirstName[7] = "Ricky";
  1083. EmployeeFirstName[8] = "Richard";
  1084. EmployeeFirstName[9] = "Riley";
  1085. EmployeeFirstName[10] = "Clinton";
  1086. EmployeeFirstName[11] = "Bob";
  1087. EmployeeFirstName[12] = "Marshal";
  1088. EmployeeFirstName[13] = "Jeffry";
  1089. EmployeeFirstName[14] = "Harley";
  1090. EmployeeFirstName[15] = "Tylor";
  1091. EmployeeFirstName[16] = "Mark";
  1092. EmployeeFirstName[17] = "Jack";
  1093. EmployeeFirstName[18] = "Alexander ";
  1094. EmployeeFirstName[19] = "Daniel";
  1095. EmployeeFirstName[0] = "Justin";
  1096.  
  1097. String[] EmployeeLastName = new String[20];
  1098.  
  1099. EmployeeLastName[0] = "White";
  1100. EmployeeLastName[1] = "Gram";
  1101. EmployeeLastName[2] = "Barden";
  1102. EmployeeLastName[3] = "Hill";
  1103. EmployeeLastName[4] = "Tesi";
  1104. EmployeeLastName[5] = "Carlli";
  1105. EmployeeLastName[6] = "Zee";
  1106. EmployeeLastName[7] = "Skouras";
  1107. EmployeeLastName[8] = "Edley";
  1108. EmployeeLastName[9] = "Dalton";
  1109. EmployeeLastName[10] = "Judd";
  1110. EmployeeLastName[11] = "Mcneill";
  1111. EmployeeLastName[12] = "Ettner";
  1112. EmployeeLastName[13] = "Hansen";
  1113. EmployeeLastName[14] = "Hime";
  1114. EmployeeLastName[15] = "Revlin";
  1115. EmployeeLastName[16] = "Keller";
  1116. EmployeeLastName[17] = "Rew";
  1117. EmployeeLastName[18] = "Griffith";
  1118. EmployeeLastName[19] = "Da silva";
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. String tempString1 = jCmboBoxOrigin.getSelectedItem().toString();
  1127. String tempString2 = jCmboBoxDest.getSelectedItem().toString();
  1128. int rnd = 0;
  1129.  
  1130. if (tempString1.equals(tempString2)) {
  1131. JOptionPane.showMessageDialog(rootPane, "Origin and Destination CAN NOT be the same", "Error", JOptionPane.ERROR_MESSAGE);
  1132. } else {
  1133. try {
  1134. //flight generator + folders generators
  1135. rnd = (int) ((Math.random() * (999 - 100 + 1)) + 100);
  1136. Flight f = new Flight(rnd, jCmboBoxPlaneType.getSelectedItem().toString(), jCmboBoxOrigin.getSelectedItem().toString(), jCmboBoxDest.getSelectedItem().toString());
  1137. File FlightDir = new File("DataFiles/Flights/" + rnd);
  1138. FlightDir.mkdir();
  1139. File AttendantsDir = new File("DataFiles/Flights/" + rnd + "/Attendants");
  1140. AttendantsDir.mkdir();
  1141. File PilotsDir = new File("DataFiles/Flights/" + rnd + "/Pilots");
  1142. PilotsDir.mkdir();
  1143. FileWriter fileWriter;
  1144. fileWriter = new FileWriter("DataFiles/Flights/" + rnd + "/FlightInformation.txt");
  1145.  
  1146. BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
  1147. bufferedWriter.write("Flight number: " + rnd);
  1148. bufferedWriter.newLine();
  1149. bufferedWriter.write("Origin of flight: " + jCmboBoxOrigin.getSelectedItem().toString());
  1150. bufferedWriter.newLine();
  1151. bufferedWriter.write("Destination of flight: " + jCmboBoxDest.getSelectedItem().toString());
  1152. bufferedWriter.newLine();
  1153. bufferedWriter.write("Plane Type: " + jCmboBoxPlaneType.getSelectedItem().toString());
  1154. bufferedWriter.newLine();
  1155.  
  1156. bufferedWriter.close();
  1157. //flight number update
  1158. String tempLineReader;
  1159. int intTempLineReader;
  1160. FileReader flightNumberFileReader = new FileReader("DataFiles/Flights/FlightsNumber.txt");
  1161. BufferedReader flightNumberBufferedReader = new BufferedReader(flightNumberFileReader);
  1162. tempLineReader = flightNumberBufferedReader.readLine();
  1163. intTempLineReader = Integer.parseInt(tempLineReader);
  1164. intTempLineReader = intTempLineReader + 1;
  1165.  
  1166. FileWriter fileWriterNumberOfFlights;
  1167. fileWriterNumberOfFlights = new FileWriter("DataFiles/Flights/FlightsNumber.txt");
  1168. BufferedWriter bufferedWriterNumberOfFlights = new BufferedWriter(fileWriterNumberOfFlights);
  1169. bufferedWriterNumberOfFlights.write(Integer.toString(intTempL

Report this snippet  

You need to login to post a comment.