HotkeyButton: allow binding the space key
This commit is contained in:
@@ -26,6 +26,8 @@ package net.runelite.client.plugins.config;
|
|||||||
|
|
||||||
import java.awt.event.KeyAdapter;
|
import java.awt.event.KeyAdapter;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.client.config.Keybind;
|
import net.runelite.client.config.Keybind;
|
||||||
@@ -39,10 +41,16 @@ class HotkeyButton extends JButton
|
|||||||
public HotkeyButton(Keybind value, boolean modifierless)
|
public HotkeyButton(Keybind value, boolean modifierless)
|
||||||
{
|
{
|
||||||
setValue(value);
|
setValue(value);
|
||||||
addActionListener(e ->
|
addMouseListener(new MouseAdapter()
|
||||||
{
|
{
|
||||||
setValue(Keybind.NOT_SET);
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e)
|
||||||
|
{
|
||||||
|
// We have to use a mouse adapter instead of an action listener so the press action key (space) can be bound
|
||||||
|
setValue(Keybind.NOT_SET);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
addKeyListener(new KeyAdapter()
|
addKeyListener(new KeyAdapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user