0
Hello! Everyone who has ever worked with Java at least once must have seen codes intended for terminal (console) use, such as the method println()
, located in System.out
.
I wonder if there is a terminal emulator for Java Swing. Just out of curiosity! For example: I have a Swing window, and inside it I need a component that "rotates" instructions to the terminal (console). Here the little block:
Thread.sleep(1000);
System.out.println("Preparando-se para explodir...");
Thread.sleep(1000);
System.out.println("3");
Thread.sleep(1000);
System.out.println("2");
Thread.sleep(1000);
System.out.println("1");
Thread.sleep(1000);
System.out.println("KABUUUUUUUUUUUUUUM!!!!");
Thread.sleep(1000);
If you have not understood, think about those program installers (the famous Next, next, Finish). In them there is a component that shows you the course of the installation (creation of folders, settings, etc.). This would be the System.out.println()
.
So you could help me?
Actually the println method, is not associated with a console, is a Printstream which is an Outputstream, it may be associated with a file.
– Filipe Miranda
Think about it: Eclipse shows a console in programs, right? There’s a way I can put this "console" in the Swing window?
– Gabriel
I missed giving this reference: http://docs.oracle.com/javase/7/docs/api/java/lang/System.html#out
– Filipe Miranda
I think so, yeah. For example: if you use a swing inputText, you can write commands to the terminal and read the results of them wherever you want using the Runtime class
– Paulo Gustavo