Alright, I'm trying to make simple console games to get started and I'm wanting to render a console Tic-Tac-Toe board. The problem I'm having is that I'd like to be able to capture either the arrow keys to move the selection inside the board or capture the space key. This will be a constantly running loop.
No matter how much I have looked around, I can't figure out how I'd go about doing this without implementing some GUI application to attach to. I'd like to hope it's possible at all. Can someone give me some pointers? Here is what I was trying to just capture keyboard input just to see what value Java thinks the arrow key is:
import java.util.Scanner;
import java.awt.*;
import java.awt.event.*;
public class KeyListener extends KeyAdapter
{
public static void main(String[] args)
{
String choice = keyboard.nextLine();
System.out.println("Running listener...");
}
public static char getKeyPressed(KeyEvent e)
{
char key = e.getKeyChar();
System.out.println("You pressed: "+key);
return key;
}
}