1

I was going through this thread and I was wondering, if maybe we could use the scroll-bars to do that?

How to Use Scroll Panes describes how to do things using scroll bars. If I am making a terminal based application using Java for a Linux OS, then can't I use code that will move the terminal knob/scrollbar move down further? I mean, that is how even the BASH "clear" works, right? So, maybe this console-based Java app can move the console scroll down and pretend to clear the screen?

Now, my problem is that I am unable to find any class within this "Scroll Pane API" documentation that would help me do that. If anyone has worked with this API before can help me, it would be much appreciated!

Community
  • 1
  • 1
shikharraje
  • 127
  • 1
  • 17

1 Answers1

1

..maybe we could use the scroll-bars to do that?

No. You cannot 'wrap the CLI in a JScrollPane (or add any JScrollBar instances)'. It is a native component that is outside the control (beyond textual output) of Java.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Thanks Andrew Thompson, that clarifies things.I guess I can close this thread now. – shikharraje Jun 14 '12 at 10:38
  • I believe there are platform specific 'escape codes' that provide the ability to clear the console. I have no further information on that - I make GUIs and do not worry about CLI output beyond making the strings pretty. – Andrew Thompson Jun 14 '12 at 10:44
  • Yes, I had read about those on the same thread, but didn't want to make it platform specific. I CAN do it, sure, but that would involve making calls to System.getProperty and all (source: http://stackoverflow.com/questions/1682212/clear-screen-option-in-java#1682278). Was just wondering that, since Java can be used to MAKE windows on a OS, can it also manipulate windows MADE by the OS, kinda like a 2-way street. But this really helps, thank you so much once again! – shikharraje Jun 14 '12 at 10:52