Search code examples
javaswingtextterminaljtextcomponent

Java text based application


The main idea is to try and make an application that would have look-and-feel of a standard Linux-type terminal. Now I am limited to Java and here is what I want.

  1. Main Window (independent JFrame) with top menu (ok this I know how to do)
  2. Entire area below the menubar is for "console" that users could interact by typing in the commands (this I have no clue about).

Is there any easy-enough way of doing such a thing. This should be a text processing app and should run system-independent and standalone. All work logic should be derived from user input.

Any ideas?


Solution

  • The 'console' could be implemented using a JTextPane. Whenever the window has focus, you can write any keypress to the text pane and parse, execute whenever 'Enter' is pressed (use a KeyListener and implement keyTyped).