git://git.nikiroo.be
/
fanfix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9017ceb
)
ListenerPanel: simplify
author
Niki Roo
<niki@nikiroo.be>
Thu, 9 Apr 2020 11:22:18 +0000
(13:22 +0200)
committer
Niki Roo
<niki@nikiroo.be>
Thu, 9 Apr 2020 11:22:18 +0000
(13:22 +0200)
src/be/nikiroo/fanfix_swing/gui/utils/ListenerPanel.java
patch
|
blob
|
blame
|
history
diff --git
a/src/be/nikiroo/fanfix_swing/gui/utils/ListenerPanel.java
b/src/be/nikiroo/fanfix_swing/gui/utils/ListenerPanel.java
index 0d356cf9679739370d69dd04f6d97ce0bc3cf2ac..9e321fd972f163a5dd781943bdada94486380e1b 100644
(file)
--- a/
src/be/nikiroo/fanfix_swing/gui/utils/ListenerPanel.java
+++ b/
src/be/nikiroo/fanfix_swing/gui/utils/ListenerPanel.java
@@
-90,12
+90,11
@@
public class ListenerPanel extends JPanel {
protected synchronized void fireActionPerformed(String listenerCommand) {
ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
listenerCommand);
protected synchronized void fireActionPerformed(String listenerCommand) {
ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
listenerCommand);
- if (hasListeners()) {
- Object[] listeners = listenerList.getListenerList();
- for (int i = listeners.length - 2; i >= 0; i -= 2) {
- if (listeners[i] == ActionListener.class) {
- ((ActionListener) listeners[i + 1]).actionPerformed(e);
- }
+
+ ActionListener[] listeners = getListeners(ActionListener.class);
+ if (listeners.length > 0) {
+ for (ActionListener action : listeners) {
+ action.actionPerformed(e);
}
} else {
waitingQueue.add(e);
}
} else {
waitingQueue.add(e);