package net.liquidpineapple.pang;

import javafx.scene.input.KeyCode;
import lombok.extern.slf4j.Slf4j;
import net.liquidpineapple.pang.gui.Board;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;

/**
 * @author Govert de Gans
 * @date 2016-09-12
 */
@Slf4j
public class InputHandler implements MouseListener, KeyListener{

    private static HashSet<Integer> keysPressed = new HashSet<>();
    private static Point mousePos;
    private static int mouseButtonPressed;

    public InputHandler() {}

    @Override
    public void keyPressed(KeyEvent e) {
        keysPressed.add(e.getKeyCode());
    }

    @Override
    public void keyReleased(KeyEvent e) {
        keysPressed.remove(e.getKeyCode());
    }

    @Override
    public void keyTyped(KeyEvent e) {}


    @Override
    public void mouseClicked(MouseEvent e) {

    }

    @Override
    public void mousePressed(MouseEvent e) {
        mousePos = new Point(e.getX(), e.getY());
        mouseButtonPressed = e.getButton();
        log.info("pang-1");
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        mouseButtonPressed = 0;
    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }

    public static boolean isKeyPressed(int keyCode) {
        return keysPressed.contains(keyCode);
    }

    public static boolean isLeftMouseButtonDown() {
        return mouseButtonPressed == MouseEvent.BUTTON1;
    }

    public static boolean isRightMouseButtonDown() {
        return mouseButtonPressed == MouseEvent.BUTTON2;
    }

    public static boolean isMiddleMouseButtonDown() {
        return mouseButtonPressed == MouseEvent.BUTTON3;
    }

    public static Point getMousePos() {
        return mousePos;
    }

    public static void clearState() {
        keysPressed.clear();
        mouseButtonPressed = 0;
    }
}

@@ -39,111 +39,33 @@
 ort 
-javafx.scene.input.KeyCode;%0Aimport lombok.extern.slf4j.Slf4j;%0Aimport net.liquidpineapple.pang.gui.Board
+lombok.extern.slf4j.Slf4j
 ;%0A%0Ai
@@ -78,15 +78,12 @@
 java
-x.swing
+.awt
 .*;%0A
@@ -90,33 +90,46 @@
 import java.awt.
-*
+event.KeyEvent
 ;%0Aimport java.aw
@@ -136,17 +136,27 @@
 t.event.
-*
+KeyListener
 ;%0Aimport
@@ -165,48 +165,65 @@
 ava.
-util.ArrayList;%0Aimport java.util.HashSet
+awt.event.MouseEvent;%0Aimport java.awt.event.MouseListener
 ;%0Aim
@@ -241,16 +241,15 @@
 til.
-Iterator
+HashSet
 ;%0A%0A/

Optimize imports