• Post Reply Bookmark Topic Watch Topic
  • New Topic

Refreshing console text?  RSS feed

 
Pete Letkeman
Ranch Foreman
Posts: 901
26
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create 100% console program, fairly simple and I don't want to use JavaFX or Swing or AWT.

How can I go from screen #1 to screen #2 to screen #3 without redrawing the full console screen each time?
Also, what the best method for changing the foreground color of the text in a console Java program?

This will be 100% console based, no graphics meaning no use of Swing, AWT of JavaFX.
 
Norm Radder
Rancher
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That might require a special OS and hardware.  I don't think PCs have that capability.
 
Pete Letkeman
Ranch Foreman
Posts: 901
26
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I recall that I was able to do something like this with Pascal for DOS/Win 3.11. However this is going back a number of years.

When I say redraw I mean calling all of the functions to draw the elements once again. This could take seconds or longer.
However if I were able to refresh just what has changed then the time to draw would be quicker.

It's totally possible that I'm recalling things incorrectly as Win 3.11 was a number of years ago.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's likely OS-dependent, but I recall that there are escape sequences that you can send to the terminal to affect writing position and such. It's likely been over 30 years since I've done such so it's hazy.
 
Pete Letkeman
Ranch Foreman
Posts: 901
26
Android Chrome IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, I kind of thought that I was asking a bit too much after all that is what Swing, AWT and JavaFX are for.
I did Google to see what can be done and one can use some ANSI code to change the color of the text, but that is not without it's limitations.

Perhaps the Pascal that I was using was indeed using a graphics library.
I do know that I did not need to do anything extra to use that functionality.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66306
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
https://en.wikipedia.org/wiki/ANSI_escape_code

It's coming back to me now. I used them to create a UIMS system for text terminals that mimicked GUI forms on the screen, including checkboxes and radio buttons.

Wow. I'm old...
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!