Java Code Examples for java.awt.event.KeyEvent#setKeyChar()

The following examples show how to use java.awt.event.KeyEvent#setKeyChar() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KeyRemappingListener.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void keyReleased(KeyEvent e)
{
	final int keyCode = e.getKeyCode();
	final char keyChar = e.getKeyChar();

	if (keyChar != KeyEvent.CHAR_UNDEFINED)
	{
		blockedChars.remove(keyChar);
	}

	final Integer mappedKeyCode = modified.remove(keyCode);
	if (mappedKeyCode != null)
	{
		e.setKeyCode(mappedKeyCode);
		e.setKeyChar(KeyEvent.CHAR_UNDEFINED);
	}
}
 
Example 2
Source File: KeyRemappingListener.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void keyReleased(KeyEvent e)
{
	final int keyCode = e.getKeyCode();
	final char keyChar = e.getKeyChar();

	if (keyChar != KeyEvent.CHAR_UNDEFINED)
	{
		blockedChars.remove(keyChar);
	}

	final Integer mappedKeyCode = modified.remove(keyCode);
	if (mappedKeyCode != null)
	{
		e.setKeyCode(mappedKeyCode);
		e.setKeyChar(KeyEvent.CHAR_UNDEFINED);
	}
}