/** Removes timer and all listeners. */ private void removeTimer () { if (timer!=null) { ActionListener[] l = (ActionListener[])timer.getListeners (ActionListener.class); for (int i=0; i<l.length; i++) { timer.removeActionListener (l[i]); } timer.stop (); timer = null; } }
/** Removes timer and all listeners. */ private void removeTimer() { if (timer != null) { ActionListener[] l = timer.getListeners (ActionListener.class); for (int i = 0; i < l.length; i++) { timer.removeActionListener(l[i]); } timer.stop(); timer = null; } }
/** Removes timer and all listeners. */ private void removeTimer() { if (timer != null) { ActionListener[] l = timer.getListeners(ActionListener.class); for (int i = 0; i < l.length; i++) { timer.removeActionListener(l[i]); } timer.stop(); timer = null; } }
/** Removes timer and all listeners. */ private void removeTimer () { if (timer!=null) { ActionListener[] l = (ActionListener[])timer.getListeners (ActionListener.class); for (int i=0; i<l.length; i++) { timer.removeActionListener (l[i]); } timer.stop (); timer = null; } }
/** * Dispose the dialog */ public void dispose() { super.dispose(); JETAComponentCleanser cleanser = new JETAComponentCleanser(); cleanser.cleanse(this); m_timer.stop(); ActionListener[] als = (ActionListener[]) (m_timer.getListeners(ActionListener.class)); if (als != null) { for (int index = 0; index < als.length; index++) { m_timer.removeActionListener(als[index]); } } m_cmdListener = null; m_controller = null; if (m_validators != null) m_validators.clear(); m_initialFocusComponent = null; if (m_listeners != null) m_listeners.clear(); if (m_contentpane != null) { m_contentpane.removeAll(); m_contentpane = null; } m_primaryPanel = null; }
@Override public void actionPerformed(ActionEvent evt) { // check if task is completed or user has clicked cancel button if (task.hasUserTriedToCancel() || task.isDone()) { // we are done progressMonitor.close(); Toolkit.getDefaultToolkit().beep(); timer.stop(); log.info("Stopped the timer"); // getting an array of Action Listeners from Timer Listener (will have // only one element) ActionListener[] als = timer.getListeners(ActionListener.class); // Removing Action Listener from timer if (als.length > 0){ timer.removeActionListener(als[0]); } if (longRunningProcess != null && !task.isDone()) { log.info("Trying to cancel the long running process: {}", longRunningProcess); longRunningProcess.cancel(); } } } }