2

How would I output console information to a GUI? I have a application that has a GUI up till I have the user move within directories similar to the CLI in linux. So how would I port the output and input from a console into a GUI. Would JPanel be the way to go or something else?

UnbrandedTech
  • 461
  • 6
  • 14
  • Please render your question more precisely. – Stefan Apr 12 '12 at 17:44
  • i have a semi-console based application.it logs into a sever and then lets a user navigate the directories. it has joptionpanes for username and password. but for the navigation it user a Linux based navigation (ls, cd, etc..). i want to make it ALL GUI and have no console part at all. what would be a good way to do that. what direction should i look into. thank you in advance. – UnbrandedTech Apr 12 '12 at 22:17

2 Answers2

2

Technically, if you wanted to, you could use JTextArea to accomplish this. Instead of writing to the console what you'd normally write, such as some information telling the programmer that something was successful or unsuccessful (for troubleshooting of course), you can use JTextArea's append() method to write what you would normally write on 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 the API for details

Anthony
  • 496
  • 3
  • 9
1

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

crownlessking
  • 1,182
  • 1
  • 17
  • 22