Skip to content

Commit

Permalink
Bug fix: Only process KeyEvents from the 5-way controller for KWTSele…
Browse files Browse the repository at this point in the history
…ctableLabels.
  • Loading branch information
apetresc committed Aug 26, 2010
1 parent bf5306a commit 9d91388
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/org/kwt/ui/KWTSelectableLabel.java
Expand Up @@ -6,6 +6,7 @@
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import java.util.Iterator;
import java.util.LinkedList;
Expand All @@ -29,6 +30,7 @@ public class KWTSelectableLabel extends KLabel {
private static final long serialVersionUID = 8118660222383683366L;

private static final int BUTTON_DOWN_EVENT = 401;
private static final int SELECT_BUTTON_KEY = 61451;
private static final int DEFAULT_UNDERLINE_WIDTH = 5;
private static final int DEFAULT_UNDERLINE_GAP = 2;

Expand Down Expand Up @@ -235,6 +237,7 @@ public void addActionListener(ActionListener listener) {
protected void processEvent(AWTEvent e) {
switch(e.getID()) {
case BUTTON_DOWN_EVENT:
if (((KeyEvent) e).getKeyCode() != SELECT_BUTTON_KEY) break;
Iterator it = actionListeners.iterator();
while (it.hasNext()) {
ActionListener listener = (ActionListener) it.next();
Expand Down

0 comments on commit 9d91388

Please sign in to comment.