Advertisement
Guest User

Untitled

a guest
Apr 11th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.87 KB | None | 0 0
  1. import BusStationFinal.logic.*;
  2. import java.awt.BorderLayout;
  3. import java.awt.EventQueue;
  4. import javax.swing.DefaultListModel;
  5. import javax.swing.JFrame;
  6. import javax.swing.JPanel;
  7. import javax.swing.border.EmptyBorder;
  8. import javax.swing.GroupLayout;
  9. import javax.swing.GroupLayout.Alignment;
  10. import javax.swing.JLayeredPane;
  11. import java.awt.CardLayout;
  12. import javax.swing.JMenuBar;
  13. import javax.swing.JMenu;
  14. import java.awt.Toolkit;
  15. import javax.swing.JLabel;
  16. import javax.swing.ImageIcon;
  17. import javax.swing.JCheckBox;
  18. import javax.swing.JDialog;
  19. import javax.swing.LayoutStyle.ComponentPlacement;
  20. import javax.swing.SwingConstants;
  21. import javax.lang.model.element.Element;
  22. import javax.swing.ButtonGroup;
  23. import javax.swing.JTextField;
  24. import javax.swing.JPasswordField;
  25. import javax.swing.JButton;
  26. import java.awt.Font;
  27. import java.awt.event.ActionListener;
  28. import java.util.ArrayList;
  29. import java.awt.event.ActionEvent;
  30. import javax.swing.JMenuItem;
  31. import javax.swing.JOptionPane;
  32. import javax.swing.JScrollPane;
  33. import javax.swing.JList;
  34. import javax.swing.border.TitledBorder;
  35. import javax.swing.UIManager;
  36. import java.awt.Color;
  37.  
  38. public class MainFrame extends JFrame {
  39.  
  40. private JPanel contentPane;
  41. private final ButtonGroup buttonGroup = new ButtonGroup();
  42. private JTextField textField;
  43. private JPasswordField passwordField;
  44. private JPanel MainPanel;
  45. private JPanel PassengerPanel;
  46. private JPanel DriverPanel;
  47. private JPanel ManagerPanel;
  48. private boolean isPassenger = false , isManager = false , isDriver = false;
  49. Main fess = new Main();
  50. private JPanel viewListPanel;
  51. private JLabel lblSelect;
  52. DefaultListModel<Trip> listModel = new DefaultListModel<Trip>();
  53.  
  54.  
  55. /**
  56. * Launch the application.
  57. */
  58. public static void main(String[] args) {
  59. EventQueue.invokeLater(new Runnable() {
  60. public void run() {
  61. try {
  62. MainFrame frame = new MainFrame();
  63. frame.setVisible(true);
  64. } catch (Exception e) {
  65. e.printStackTrace();
  66. }
  67. }
  68. });
  69. }
  70.  
  71. public void switchScenes(JLayeredPane layeredPane, JPanel panel)
  72. {
  73. layeredPane.removeAll();
  74. layeredPane.add(panel);
  75. layeredPane.repaint();
  76. layeredPane.revalidate();
  77.  
  78. }
  79. public DefaultListModel<Trip> updateListModel(ArrayList<Trip> tripList)
  80. {
  81. DefaultListModel<Trip> updatedModel = new DefaultListModel<Trip>();
  82. updatedModel.clear();
  83. while(!tripList.isEmpty())
  84. {
  85.  
  86. }
  87.  
  88. return updatedModel;
  89. }
  90.  
  91. /**
  92. * Create the frame.
  93. */
  94. public MainFrame() {
  95. setResizable(false);
  96. setIconImage(Toolkit.getDefaultToolkit().getImage(MainFrame.class.getResource("/BusStationFinal/resorces/bus.png")));
  97. setTitle("Bus Station DEMO");
  98. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  99. setBounds(100, 100, 985, 819);
  100. contentPane = new JPanel();
  101. contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  102. setContentPane(contentPane);
  103. contentPane.setLayout(null);
  104.  
  105. JLayeredPane layeredPane = new JLayeredPane();
  106. layeredPane.setBounds(0, 29, 979, 734);
  107. contentPane.add(layeredPane);
  108. layeredPane.setLayout(new CardLayout(0, 0));
  109.  
  110. MainPanel = new JPanel();
  111. layeredPane.add(MainPanel, "name_138950836708208");
  112.  
  113. JLabel imageBus = new JLabel("");
  114. imageBus.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/bus-side-view.png")));
  115.  
  116. JCheckBox chckbxPassenger = new JCheckBox("Passenger");
  117. chckbxPassenger.setFont(new Font("Tahoma", Font.PLAIN, 20));
  118. chckbxPassenger.setSelected(true);
  119. buttonGroup.add(chckbxPassenger);
  120.  
  121. JCheckBox chckbxDriver = new JCheckBox("Driver");
  122. chckbxDriver.setFont(new Font("Tahoma", Font.PLAIN, 20));
  123. buttonGroup.add(chckbxDriver);
  124.  
  125. JCheckBox chckbxManager = new JCheckBox("Manager");
  126. chckbxManager.setFont(new Font("Tahoma", Font.PLAIN, 20));
  127. buttonGroup.add(chckbxManager);
  128.  
  129. JLabel lblusername = new JLabel("USERNAME :");
  130. lblusername.setFont(new Font("Tahoma", Font.PLAIN, 20));
  131.  
  132. JLabel lblpassword = new JLabel("PASSWORD :");
  133. lblpassword.setFont(new Font("Tahoma", Font.PLAIN, 20));
  134.  
  135. textField = new JTextField();
  136. textField.setFont(new Font("Tahoma", Font.PLAIN, 20));
  137. textField.setColumns(10);
  138.  
  139. passwordField = new JPasswordField();
  140. passwordField.setFont(new Font("Tahoma", Font.PLAIN, 20));
  141.  
  142. JButton btnlogin = new JButton("LOGIN");
  143. btnlogin.addActionListener(new ActionListener() {
  144. public void actionPerformed(ActionEvent arg0) {
  145.  
  146. if((textField.getText().isEmpty()||passwordField.getText().isEmpty() )) {
  147. JOptionPane.showMessageDialog(null,"ERROR,ENTER YOUR USER NAME AND PASSWORD");System.out.println(textField.getText());}
  148. else if(chckbxPassenger.isSelected())
  149. {
  150. if(fess.check(textField.getText(), String.valueOf(passwordField.getPassword())))//Authenticate passenger
  151. {
  152. JOptionPane.showMessageDialog(null,"WELCOME HOME:)");
  153. isPassenger = true;
  154. switchScenes(layeredPane, PassengerPanel);
  155. textField.setText("");
  156. passwordField.setText("");
  157. }
  158. else
  159. JOptionPane.showMessageDialog(null,"INVALID USER NAME OR PASSWORD!");
  160. }
  161. else if(chckbxDriver.isSelected())
  162. {
  163. if(true)//Authenticate driver
  164. {
  165. JOptionPane.showMessageDialog(null,"WELCOME HOME:)");
  166. isDriver = true;
  167. switchScenes(layeredPane, DriverPanel);
  168. textField.setText("");
  169. passwordField.setText("");
  170. }
  171. else
  172. JOptionPane.showMessageDialog(null,"INVALID USER NAME OR PASSWORD!");
  173.  
  174. }
  175. else
  176. {
  177. if(true)//Authenticate manager
  178. {
  179. JOptionPane.showMessageDialog(null,"WELCOME HOME:)");
  180. isManager = true;
  181. switchScenes(layeredPane, ManagerPanel);
  182. textField.setText("");
  183. passwordField.setText("");
  184. }
  185. else
  186. JOptionPane.showMessageDialog(null,"INVALID USER NAME OR PASSWORD!");
  187. }
  188. }
  189. });
  190. btnlogin.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/login_16.png")));
  191. btnlogin.setFont(new Font("Tahoma", Font.PLAIN, 20));
  192. GroupLayout gl_MainPanel = new GroupLayout(MainPanel);
  193. gl_MainPanel.setHorizontalGroup(
  194. gl_MainPanel.createParallelGroup(Alignment.TRAILING)
  195. .addGroup(gl_MainPanel.createSequentialGroup()
  196. .addGroup(gl_MainPanel.createParallelGroup(Alignment.LEADING)
  197. .addGroup(gl_MainPanel.createSequentialGroup()
  198. .addGap(353)
  199. .addComponent(imageBus, GroupLayout.DEFAULT_SIZE, 302, Short.MAX_VALUE))
  200. .addGroup(gl_MainPanel.createSequentialGroup()
  201. .addGap(148)
  202. .addGroup(gl_MainPanel.createParallelGroup(Alignment.LEADING)
  203. .addGroup(gl_MainPanel.createSequentialGroup()
  204. .addComponent(chckbxPassenger)
  205. .addPreferredGap(ComponentPlacement.RELATED, 193, Short.MAX_VALUE)
  206. .addComponent(chckbxDriver)
  207. .addGap(136))
  208. .addGroup(gl_MainPanel.createSequentialGroup()
  209. .addGroup(gl_MainPanel.createParallelGroup(Alignment.TRAILING)
  210. .addComponent(lblusername)
  211. .addComponent(lblpassword))
  212. .addGap(18)
  213. .addGroup(gl_MainPanel.createParallelGroup(Alignment.LEADING)
  214. .addComponent(passwordField, GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)
  215. .addComponent(textField, 393, 393, 393))))))
  216. .addGap(48)
  217. .addGroup(gl_MainPanel.createParallelGroup(Alignment.TRAILING)
  218. .addComponent(chckbxManager)
  219. .addComponent(btnlogin))
  220. .addGap(141))
  221. );
  222. gl_MainPanel.setVerticalGroup(
  223. gl_MainPanel.createParallelGroup(Alignment.LEADING)
  224. .addGroup(gl_MainPanel.createSequentialGroup()
  225. .addGap(63)
  226. .addComponent(imageBus, GroupLayout.PREFERRED_SIZE, 166, GroupLayout.PREFERRED_SIZE)
  227. .addGap(82)
  228. .addGroup(gl_MainPanel.createParallelGroup(Alignment.LEADING)
  229. .addComponent(chckbxManager)
  230. .addGroup(gl_MainPanel.createParallelGroup(Alignment.BASELINE)
  231. .addComponent(chckbxDriver)
  232. .addComponent(chckbxPassenger)))
  233. .addGroup(gl_MainPanel.createParallelGroup(Alignment.LEADING)
  234. .addGroup(gl_MainPanel.createSequentialGroup()
  235. .addGap(112)
  236. .addGroup(gl_MainPanel.createParallelGroup(Alignment.BASELINE)
  237. .addComponent(lblusername)
  238. .addComponent(textField, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE))
  239. .addGap(28)
  240. .addGroup(gl_MainPanel.createParallelGroup(Alignment.BASELINE)
  241. .addComponent(passwordField, GroupLayout.PREFERRED_SIZE, 49, GroupLayout.PREFERRED_SIZE)
  242. .addComponent(lblpassword)))
  243. .addGroup(gl_MainPanel.createSequentialGroup()
  244. .addGap(148)
  245. .addComponent(btnlogin, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)))
  246. .addContainerGap(152, Short.MAX_VALUE))
  247. );
  248. MainPanel.setLayout(gl_MainPanel);
  249.  
  250. PassengerPanel = new JPanel();
  251. layeredPane.add(PassengerPanel, "name_138953435671015");
  252.  
  253. JButton btnBookTrip = new JButton("Book Trip");
  254. btnBookTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  255. btnBookTrip.addActionListener(new ActionListener() {
  256. public void actionPerformed(ActionEvent arg0) {
  257. switchScenes(layeredPane, viewListPanel);
  258. /////////////////////////////////////////////////////////////////////////
  259. }
  260. });
  261.  
  262. JLabel label = new JLabel("");
  263. label.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/traffic-sign_256.png")));
  264.  
  265. JButton btnBuyBookedTrip = new JButton("Buy Ticket");
  266. btnBuyBookedTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  267.  
  268. JButton btnViewBookedTrips = new JButton("View Booked Trips");
  269. btnViewBookedTrips.setFont(new Font("Tahoma", Font.PLAIN, 20));
  270.  
  271. JButton btnViewAllTripsPassenger = new JButton("View All Trips");
  272. btnViewAllTripsPassenger.addActionListener(new ActionListener() {
  273. public void actionPerformed(ActionEvent e) {
  274. lblSelect.setVisible(false);
  275. switchScenes(layeredPane, viewListPanel);
  276. }
  277. });
  278. btnViewAllTripsPassenger.setFont(new Font("Tahoma", Font.PLAIN, 20));
  279.  
  280. JButton btnCancelBookedTrip = new JButton("Cancel Booked Trip");
  281. btnCancelBookedTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  282.  
  283. JLabel previewPassengerNamelbl = new JLabel("New label");
  284.  
  285. JButton btnPassengerLogout = new JButton("LOGOUT");
  286. btnPassengerLogout.addActionListener(new ActionListener() {
  287. public void actionPerformed(ActionEvent arg0) {
  288. if (JOptionPane.showConfirmDialog(null,"ARE YOU SURE YOU WANT TO LOGOUT?") == JOptionPane.YES_OPTION) {
  289. switchScenes(layeredPane, MainPanel);
  290. }
  291. }
  292. });
  293. btnPassengerLogout.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/logout_16.png")));
  294. btnPassengerLogout.setFont(new Font("Tahoma", Font.PLAIN, 20));
  295. GroupLayout gl_PassengerPanel = new GroupLayout(PassengerPanel);
  296. gl_PassengerPanel.setHorizontalGroup(
  297. gl_PassengerPanel.createParallelGroup(Alignment.TRAILING)
  298. .addGroup(gl_PassengerPanel.createSequentialGroup()
  299. .addGap(361)
  300. .addComponent(label, GroupLayout.DEFAULT_SIZE, 259, Short.MAX_VALUE)
  301. .addPreferredGap(ComponentPlacement.RELATED, 215, Short.MAX_VALUE)
  302. .addGroup(gl_PassengerPanel.createParallelGroup(Alignment.LEADING)
  303. .addComponent(previewPassengerNamelbl)
  304. .addComponent(btnPassengerLogout))
  305. .addGap(35))
  306. .addGroup(gl_PassengerPanel.createSequentialGroup()
  307. .addGap(213)
  308. .addGroup(gl_PassengerPanel.createParallelGroup(Alignment.LEADING)
  309. .addGroup(gl_PassengerPanel.createSequentialGroup()
  310. .addComponent(btnViewAllTripsPassenger)
  311. .addPreferredGap(ComponentPlacement.RELATED, 227, Short.MAX_VALUE)
  312. .addComponent(btnCancelBookedTrip))
  313. .addGroup(gl_PassengerPanel.createSequentialGroup()
  314. .addComponent(btnBuyBookedTrip)
  315. .addPreferredGap(ComponentPlacement.RELATED, 263, Short.MAX_VALUE)
  316. .addComponent(btnViewBookedTrips)))
  317. .addGap(181))
  318. .addGroup(Alignment.LEADING, gl_PassengerPanel.createSequentialGroup()
  319. .addGap(422)
  320. .addComponent(btnBookTrip)
  321. .addContainerGap(440, Short.MAX_VALUE))
  322. );
  323. gl_PassengerPanel.setVerticalGroup(
  324. gl_PassengerPanel.createParallelGroup(Alignment.TRAILING)
  325. .addGroup(gl_PassengerPanel.createSequentialGroup()
  326. .addGap(26)
  327. .addComponent(previewPassengerNamelbl)
  328. .addGroup(gl_PassengerPanel.createParallelGroup(Alignment.LEADING)
  329. .addGroup(gl_PassengerPanel.createSequentialGroup()
  330. .addGap(7)
  331. .addComponent(label, GroupLayout.PREFERRED_SIZE, 205, GroupLayout.PREFERRED_SIZE)
  332. .addPreferredGap(ComponentPlacement.RELATED, 84, Short.MAX_VALUE)
  333. .addGroup(gl_PassengerPanel.createParallelGroup(Alignment.BASELINE)
  334. .addComponent(btnBuyBookedTrip, GroupLayout.PREFERRED_SIZE, 53, GroupLayout.PREFERRED_SIZE)
  335. .addComponent(btnViewBookedTrips, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE))
  336. .addGap(43)
  337. .addComponent(btnBookTrip, GroupLayout.PREFERRED_SIZE, 51, GroupLayout.PREFERRED_SIZE)
  338. .addGap(49)
  339. .addGroup(gl_PassengerPanel.createParallelGroup(Alignment.BASELINE)
  340. .addComponent(btnViewAllTripsPassenger, GroupLayout.PREFERRED_SIZE, 58, GroupLayout.PREFERRED_SIZE)
  341. .addComponent(btnCancelBookedTrip, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE))
  342. .addGap(183))
  343. .addGroup(gl_PassengerPanel.createSequentialGroup()
  344. .addGap(44)
  345. .addComponent(btnPassengerLogout, GroupLayout.PREFERRED_SIZE, 46, GroupLayout.PREFERRED_SIZE)
  346. .addContainerGap())))
  347. );
  348. PassengerPanel.setLayout(gl_PassengerPanel);
  349.  
  350. DriverPanel = new JPanel();
  351. layeredPane.add(DriverPanel, "name_138956623298965");
  352.  
  353. ManagerPanel = new JPanel();
  354. layeredPane.add(ManagerPanel, "name_138959191189031");
  355.  
  356. JLabel label_1 = new JLabel("");
  357. label_1.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/traffic-sign_256.png")));
  358.  
  359. JLabel previewManagerNamelbl = new JLabel("New label");
  360.  
  361. JButton btnManagerLogout = new JButton("LOGOUT");
  362. btnManagerLogout.addActionListener(new ActionListener() {
  363. public void actionPerformed(ActionEvent arg0) {
  364. if (JOptionPane.showConfirmDialog(null,"ARE YOU SURE YOU WANT TO LOGOUT?") == JOptionPane.YES_OPTION) {
  365. switchScenes(layeredPane, MainPanel);
  366. }
  367. }
  368. });
  369. btnManagerLogout.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/logout_16.png")));
  370. btnManagerLogout.setFont(new Font("Tahoma", Font.PLAIN, 20));
  371.  
  372. JButton btnViewAllTripsManager = new JButton("View All Trips");
  373. btnViewAllTripsManager.setFont(new Font("Tahoma", Font.PLAIN, 20));
  374.  
  375. JButton btnAddTrip = new JButton("Add Trip");
  376. btnAddTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  377.  
  378. JButton btnCancelTrip = new JButton("Cancel Trip");
  379. btnCancelTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  380.  
  381. JButton btnAssignTrip = new JButton("Assign Trip");
  382. btnAssignTrip.setFont(new Font("Tahoma", Font.PLAIN, 20));
  383.  
  384. JButton btnViewAllDrivers = new JButton("View All Drivers");
  385. btnViewAllDrivers.setFont(new Font("Tahoma", Font.PLAIN, 20));
  386. GroupLayout gl_ManagerPanel = new GroupLayout(ManagerPanel);
  387. gl_ManagerPanel.setHorizontalGroup(
  388. gl_ManagerPanel.createParallelGroup(Alignment.LEADING)
  389. .addGroup(gl_ManagerPanel.createSequentialGroup()
  390. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.LEADING)
  391. .addGroup(gl_ManagerPanel.createSequentialGroup()
  392. .addGap(361)
  393. .addComponent(label_1)
  394. .addPreferredGap(ComponentPlacement.RELATED, 183, Short.MAX_VALUE)
  395. .addComponent(btnManagerLogout))
  396. .addGroup(gl_ManagerPanel.createSequentialGroup()
  397. .addContainerGap(860, Short.MAX_VALUE)
  398. .addComponent(previewManagerNamelbl)))
  399. .addGap(50))
  400. .addGroup(Alignment.TRAILING, gl_ManagerPanel.createSequentialGroup()
  401. .addGap(205)
  402. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.TRAILING)
  403. .addComponent(btnCancelTrip)
  404. .addComponent(btnViewAllTripsManager))
  405. .addPreferredGap(ComponentPlacement.RELATED, 270, Short.MAX_VALUE)
  406. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.LEADING)
  407. .addComponent(btnAssignTrip)
  408. .addComponent(btnViewAllDrivers))
  409. .addGap(205))
  410. .addGroup(gl_ManagerPanel.createSequentialGroup()
  411. .addGap(427)
  412. .addComponent(btnAddTrip)
  413. .addContainerGap(445, Short.MAX_VALUE))
  414. );
  415. gl_ManagerPanel.setVerticalGroup(
  416. gl_ManagerPanel.createParallelGroup(Alignment.LEADING)
  417. .addGroup(gl_ManagerPanel.createSequentialGroup()
  418. .addGap(34)
  419. .addComponent(previewManagerNamelbl)
  420. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.LEADING)
  421. .addGroup(gl_ManagerPanel.createSequentialGroup()
  422. .addPreferredGap(ComponentPlacement.RELATED)
  423. .addComponent(label_1, GroupLayout.PREFERRED_SIZE, 186, GroupLayout.PREFERRED_SIZE)
  424. .addGap(154)
  425. .addComponent(btnAddTrip, GroupLayout.DEFAULT_SIZE, 52, Short.MAX_VALUE)
  426. .addPreferredGap(ComponentPlacement.RELATED))
  427. .addGroup(Alignment.TRAILING, gl_ManagerPanel.createSequentialGroup()
  428. .addGap(46)
  429. .addComponent(btnManagerLogout, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  430. .addPreferredGap(ComponentPlacement.RELATED, 158, Short.MAX_VALUE)
  431. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.BASELINE)
  432. .addComponent(btnViewAllDrivers, GroupLayout.PREFERRED_SIZE, 50, GroupLayout.PREFERRED_SIZE)
  433. .addComponent(btnViewAllTripsManager, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE))
  434. .addGap(97)))
  435. .addGap(53)
  436. .addGroup(gl_ManagerPanel.createParallelGroup(Alignment.TRAILING)
  437. .addComponent(btnAssignTrip, GroupLayout.PREFERRED_SIZE, 55, GroupLayout.PREFERRED_SIZE)
  438. .addComponent(btnCancelTrip, GroupLayout.PREFERRED_SIZE, 52, GroupLayout.PREFERRED_SIZE))
  439. .addGap(171))
  440. );
  441. ManagerPanel.setLayout(gl_ManagerPanel);
  442.  
  443. viewListPanel = new JPanel();
  444. layeredPane.add(viewListPanel, "name_233625677783422");
  445.  
  446. JScrollPane scrollPane = new JScrollPane();
  447. scrollPane.setFont(new Font("Tahoma", Font.PLAIN, 18));
  448. scrollPane.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "List Of Required Trips", TitledBorder.LEFT, TitledBorder.TOP, null, new Color(0, 0, 0)));
  449.  
  450. JButton btnProceed = new JButton("PROCEED");
  451. btnProceed.addActionListener(new ActionListener() {
  452. public void actionPerformed(ActionEvent e) {
  453. }
  454. });
  455. btnProceed.setFont(new Font("Tahoma", Font.PLAIN, 20));
  456.  
  457. lblSelect = new JLabel("Select Your Desired Trip");
  458. lblSelect.setFont(new Font("Tahoma", Font.BOLD, 25));
  459. GroupLayout gl_viewListPanel = new GroupLayout(viewListPanel);
  460. gl_viewListPanel.setHorizontalGroup(
  461. gl_viewListPanel.createParallelGroup(Alignment.LEADING)
  462. .addGroup(gl_viewListPanel.createSequentialGroup()
  463. .addGap(337)
  464. .addComponent(lblSelect, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  465. .addGap(338))
  466. .addGroup(gl_viewListPanel.createSequentialGroup()
  467. .addGap(51)
  468. .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 873, GroupLayout.PREFERRED_SIZE)
  469. .addContainerGap(55, Short.MAX_VALUE))
  470. .addGroup(gl_viewListPanel.createSequentialGroup()
  471. .addContainerGap(810, Short.MAX_VALUE)
  472. .addComponent(btnProceed)
  473. .addGap(52))
  474. );
  475. gl_viewListPanel.setVerticalGroup(
  476. gl_viewListPanel.createParallelGroup(Alignment.LEADING)
  477. .addGroup(gl_viewListPanel.createSequentialGroup()
  478. .addContainerGap()
  479. .addComponent(lblSelect)
  480. .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  481. .addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 606, GroupLayout.PREFERRED_SIZE)
  482. .addPreferredGap(ComponentPlacement.UNRELATED)
  483. .addComponent(btnProceed, GroupLayout.PREFERRED_SIZE, 48, GroupLayout.PREFERRED_SIZE)
  484. .addContainerGap())
  485. );
  486.  
  487. JList list = new JList(listModel);
  488. list.setFont(new Font("Tahoma", Font.PLAIN, 18));
  489. scrollPane.setViewportView(list);
  490. viewListPanel.setLayout(gl_viewListPanel);
  491.  
  492. JMenuBar menuBar = new JMenuBar();
  493. menuBar.setBounds(0, 0, 979, 31);
  494. contentPane.add(menuBar);
  495.  
  496. JMenu mnFile = new JMenu("File");
  497. mnFile.setFont(new Font("Segoe UI", Font.PLAIN, 20));
  498. menuBar.add(mnFile);
  499.  
  500. JMenuItem mntmExit = new JMenuItem("Exit");
  501. mntmExit.addActionListener(new ActionListener() {
  502. public void actionPerformed(ActionEvent arg0) {
  503. JOptionPane.showConfirmDialog(null,"ARE YOU SURE YOU WANT TO EXIT?");
  504. }
  505. });
  506. mntmExit.setIcon(new ImageIcon(MainFrame.class.getResource("/BusStationFinal/resorces/exit_16.png")));
  507. mntmExit.setFont(new Font("Segoe UI", Font.PLAIN, 20));
  508. mnFile.add(mntmExit);
  509.  
  510. JMenu mnAbout = new JMenu("About");
  511. mnAbout.setFont(new Font("Segoe UI", Font.PLAIN, 20));
  512. menuBar.add(mnAbout);
  513.  
  514. JMenu mnHelp = new JMenu("Help");
  515. mnHelp.setFont(new Font("Segoe UI", Font.PLAIN, 20));
  516. menuBar.add(mnHelp);
  517. }
  518. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement