<p>I'm writing a game in Java, and I want the user to be able to provide input from both the command line and my GUI. Currently, I use this method to get input:<br></p>

<pre><code>    static String getInput(){
        System.out.println("Your move:");
        Scanner sc = new Scanner(System.in);
        return sc.nextLine();
    }
</code></pre>

<p>I want to keep using this, but let a mousePressed event emulate the user actually typing in their input as well.  It's not that efficient of a solution, but it makes sense in my application. So the question is: how do I simulate a user typing to System.in from the code side?</p>

I made an application once that could run via the command line or using a GUI.
The way I did this was to define an Interface (named IODevice) which defined the following methods:
public String getInput();
public void showOutput(String output);
I then had two classes which implemented this interface - One used the host computer's terminal (as you are doing now) and one used a JTextArea (output) / JOptionPane (input).
Perhaps you could do something similar - To change the input device used, simply change the instance of the IODevice.
Hope this is of some use.