Skip to content

Commit

Permalink
propagate mouse events from address bar field
Browse files Browse the repository at this point in the history
Closes #224
  • Loading branch information
hrj committed Oct 19, 2016
1 parent 9b8fae0 commit ceac6a7
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Collection;
import java.util.Iterator;

Expand Down Expand Up @@ -54,6 +56,35 @@ public void keyPressed(final KeyEvent e) {
onKeyPressed(e);
}
});

editor.addMouseListener(new MouseListener() {

@Override
public void mouseReleased(MouseEvent e) {
processMouseEvent(e);
}

@Override
public void mousePressed(MouseEvent e) {
processMouseEvent(e);
}

@Override
public void mouseExited(MouseEvent e) {
processMouseEvent(e);
}

@Override
public void mouseEntered(MouseEvent e) {
processMouseEvent(e);
}

@Override
public void mouseClicked(MouseEvent e) {
processMouseEvent(e);
}
});

this.addPopupMenuListener(new PopupMenuListener() {
public void popupMenuWillBecomeVisible(final PopupMenuEvent e) {
onBeforePopupVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.MouseListener;

import javax.swing.ComboBoxEditor;
import javax.swing.JTextField;
Expand Down Expand Up @@ -111,6 +112,10 @@ public void addKeyListener(final java.awt.event.KeyListener listener) {
this.textField.addKeyListener(listener);
}

public void addMouseListener(MouseListener listener) {
this.textField.addMouseListener(listener);
}

public void removeKeyListener(final java.awt.event.KeyListener listener) {
this.textField.removeKeyListener(listener);
}
Expand Down

0 comments on commit ceac6a7

Please sign in to comment.