Using GUI for console input and output in java

How can I display console information in a graphical interface? I have a GUI application until the user moves inside directories like CLI in linux. So, how can I port the output and input from the console to the graphical interface. Will JPanel go or something else?

+1
source share
2 answers

Technically, if you want to, you can use JTextAreato achieve this. Instead of writing to the console what you usually write, for example, some information telling the programmer that something was successful or unsuccessful (for troubleshooting, of course), you can use the JTextArea method append()to record what you usually write to the console. Example:

javax.swing.JTextArea guiConsole = new JTextArea(10,10); //Just so you know what this is
System.out.println("This sentence is printed to the real console.");
guiConsole.append("But this one is printed to the GUI Console we made.");

See API for more details.

+1
source

I know that this was 2 years ago, but for anyone else who is trying to do the same thing, there is a Java file that can add functionality to input and output information into the GUI console, and it can be found here .

0
source

All Articles