Can you change CMD title in Java? [duplicate] - java

This question already has an answer here:
How to change command prompt (console) window title from command line Java app?
4 answers
How to print color in console using System.out.println?
6 answers
I got a console application bot, I would like to show the current status of the bot in the console title, I couldnt find a way to do it, anyone manage to do it in any chance?
//2nd but less important question, Can I color-code the console output aswell? I'd like to have a different color for every thread

Related

How to make jswing components remember its status after closing it [duplicate]

This question already has an answer here:
Best way to store data between program runs in java?
11 answers
How can I save the state of my program and then load it?
2 answers
For example, if I had checked a JCheckBox when I opened the program, how would I make the it remember the status of the checkbox so that the next time I open up the JFrame, the box stays checked.
I would also like to extend this question to other swing components like radiobuttons, color chooser, etc.
Attempted solution: The only way I can think of it is possibly making a new file so that the program can update and read the status of it and adjust the swing components when opened. However, this is too inefficient. I read online something about cookies but I am not too sure.

Show an output terminal box after clicking a button that can run the java codes

first see this image:window
To understand my question you have to see the image first.
So, I have made a program in netbeans(java) which can convert simple and easy codes ( like: Print "sum") into actual java codes (i.e. System.out.print("sum");). Now what I want to do is create a button in the window marked a (1) that is RUN, which when clicked will show a new window like the bluej output box terminal marked as (2) in the image which will show the ouput of the generated code like what is shown in bluej after compiling it. Using this students will be able to instantly type codes and see the output of their programs very fast.
private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// I want to know what code should i put here that will return the ouput.
}
for more info visit my website: http://fdti.weebly.com
Use processBuilder to launch a terminal, and execute java code.

How to use screen as input in Java [duplicate]

This question already has an answer here:
Is there a way to take a screenshot using Java and save it to some sort of image?
7 answers
How to take a screenshot in Java? [duplicate]
2 answers
I want to be able get an image or bufferedImage of my current screen in my java program. Is this possible? Thanks in advance!
Do you want to use the current screenshot in your Java application? First write code to capture the screenshot and then use it in the application.
I found this tutorial useful:
https://www.daniweb.com/software-development/java/code/216988/java-code-to-capture-your-screen-as-image

Output Program in GUI instead of CLI [duplicate]

Possible Duplicate:
create java console inside the panel
So, I have a simple program that only consists of input, computations and output. Instead of displaying the prompts, computations and results in the command line (output) of the IDE, I was hoping to embed it on another program. Maybe on a GUI item, like a text area or anything that pops up.
Are there any GUI elements that are suited for this purpose? Thanks!
you can try using Java Swing which will help you build the UI in simple drag and drop

text base programs in java

i want to create a terminal application in java, but i don't know how to replace text lines that are already printed (kind of "edit the lines that already printed"). \r only returns to the beginning of the last line, and i want to display a 2 dimensional grid.
this is a sample for what i want to print:
System.out.println("################");
System.out.println("#--------------#");
System.out.println("#--------------#");
System.out.println("################");
System.out.println("\r################");
System.out.println("#-------X------#");
System.out.println("#--------------#");
System.out.println("################");
you should try JLine library. It provides many userful functions for command line applications. http://jline.sourceforge.net/javadoc/
Using System.out.println whatever text is printed to the console is already flushed and cannot be edited. What you can do is you can clear the console and reprint using a fresh set Sys Outs. But for a graphical application I would suggest you have a look at JAVA AWT which will give you functions like paint() and repaint() and other rich UI functions.
For clearing the console you can refer to this: clear console
For JAVA AWT: AWT tutorial

Resources