public void actionPerformed(ActionEvent e) { /* * The menu is assigned to several menu bars. The listener is kept as * a separate class than the listeners already assigned to the actions * for the menu when created. */ JMenu menuOfEventTrigger = Application.frame.getJMenuBar().getMenu(1); if (e.getSource() == menuOfEventTrigger.getItem(0)) LectureManager.goToFirstPage(); else if (e.getSource() == menuOfEventTrigger.getItem(1)) LectureManager.goToLastPage(); else if (e.getSource() == menuOfEventTrigger.getItem(2)) { Application.dialogLabel.setText(DialogLabelText.changeLectureMessage); byte selectedButton = (byte) (JOptionPane.showConfirmDialog( null, Application.dialogLabel, "Change Lecture", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)); if (selectedButton == JOptionPane.YES_OPTION) { Application.frame.setJMenuBar(Application.centralProgramMenuBar); CardLayout mainPanelLayout = (CardLayout) (Application.mainPanel.getLayout()); Application.currentPanelName = Application.LECTURE_SELECT_NAME; mainPanelLayout.show(Application.mainPanel, Application.currentPanelName); } } // When the user clicks on the button to quit Lecture Mode. else if (e.getSource() == menuOfEventTrigger.getItem(3)) { Application.dialogLabel.setText(DialogLabelText.quitLectureModeMessage); byte selectedButton = (byte) (JOptionPane.showConfirmDialog( null, Application.dialogLabel, "Quit Lecture Mode", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)); if (selectedButton == JOptionPane.YES_OPTION) { Application.frame.setJMenuBar(Application.centralProgramMenuBar); Application.restartMainMenuThread(); CardLayout mainPanelLayout = (CardLayout) (Application.mainPanel.getLayout()); Application.currentPanelName = Application.MAIN_MENU_NAME; mainPanelLayout.show(Application.mainPanel, Application.currentPanelName); } } }