Hello.
Very simple. Your entire code should run in a JFrame or JApplet.
And for input from keyboard use JOptionPane.

Syed.