// ds event invoked function public void actionPerformed(ActionEvent p_cEvent) { // ds get the event source final Object cSource = p_cEvent.getSource(); try { // ds determine event (big if/else tree) if (cSource == m_cButtonLike) { _displayImage( m_cLearner.getNextPattern(CLearnerBayes.ELearnerLabel.LIKE, m_cCurrentPattern)); } else if (cSource == m_cButtonDislike) { _displayImage( m_cLearner.getNextPattern(CLearnerBayes.ELearnerLabel.DISLIKE, m_cCurrentPattern)); } else if (cSource == m_cButtonPrevious) { _displayImage(m_cLearner.getPreviousPattern()); } else if (cSource == m_cButtonReset) { // ds reset the learning process m_cLearner.reset(); // ds get a new image _displayImage(m_cLearner.getFirstDataPoint()); } } catch (SQLException e) { _logMaster("<CGUI>(actionPerformed) SQLException: " + e.getMessage()); System.out.println( "[" + CLogger.getStamp() + "]<CGUI>(actionPerformed) SQLException: " + e.getMessage()); // ds no previous image available JOptionPane.showMessageDialog(m_cFrame, "Could not load image from MySQL database"); } catch (CZEPnpIException e) { _logMaster("<CGUI>(actionPerformed) CZEPnpIException: " + e.getMessage()); System.out.println( "[" + CLogger.getStamp() + "]<CGUI>(actionPerformed) CZEPnpIException: " + e.getMessage()); // ds no previous image available JOptionPane.showMessageDialog( m_cFrame, "No previous image available - please use Like/Dislike to classify the first image"); } catch (CZEPMySQLManagerException e) { _logMaster("<CGUI>(actionPerformed) CZEPMySQLManagerException: " + e.getMessage()); System.out.println( "[" + CLogger.getStamp() + "]<CGUI>(actionPerformed) CZEPMySQLManagerException: " + e.getMessage()); // ds no previous image available JOptionPane.showMessageDialog(m_cFrame, "Could not load image from MySQL database"); } catch (MalformedURLException e) { _logMaster("<CGUI>(actionPerformed) MalformedURLException: " + e.getMessage()); System.out.println( "[" + CLogger.getStamp() + "]<CGUI>(actionPerformed) MalformedURLException: " + e.getMessage()); // ds no previous image available JOptionPane.showMessageDialog(m_cFrame, "Could not load image from MySQL database"); } catch (CZEPEoIException e) { _logMaster("<CGUI>(actionPerformed) CZEPEoIException: " + e.getMessage()); System.out.println( "[" + CLogger.getStamp() + "]<CGUI>(actionPerformed) CZEPEoIException: " + e.getMessage()); // ds no previous image available JOptionPane.showMessageDialog(m_cFrame, "Could not load image from MySQL database"); } }