List of usage examples for java.awt.event ActionEvent getModifiers
public int getModifiers()
From source file:org.yccheok.jstock.gui.AutoCompleteJComboBox.java
private ActionListener getActionListener() { return new ActionListener() { @Override/*from w ww .j ava 2s . c om*/ public void actionPerformed(ActionEvent e) { /* Handle mouse clicked. */ if ((e.getModifiers() & java.awt.event.InputEvent.BUTTON1_MASK) == java.awt.event.InputEvent.BUTTON1_MASK) { final Object object = AutoCompleteJComboBox.this.getEditor().getItem(); /* Let us be extra paranoid. */ if (object instanceof DispType) { DispType lastEnteredDisp = (DispType) object; AutoCompleteJComboBox.this.dispSubject.notify(AutoCompleteJComboBox.this, lastEnteredDisp); } else if (object instanceof StockInfo) { // From our offline database. StockInfo lastEnteredStockInfo = (StockInfo) object; AutoCompleteJComboBox.this.stockInfoSubject.notify(AutoCompleteJComboBox.this, lastEnteredStockInfo); } else { assert (false); } SwingUtilities.invokeLater(new Runnable() { @Override public void run() { // We schedule the below actions in GUI event queue, // so that DocumentListener will not be triggered. // But I am not sure why. AutoCompleteJComboBox.this.getEditor().setItem(null); AutoCompleteJComboBox.this.hidePopup(); AutoCompleteJComboBox.this.removeAllItems(); } }); } } }; }