new to group. Scrolling question

Skip to first unread message

Jeffrey Gaynor

May 20, 2020, 10:08:03 AM5/20/20
to lanterna-discuss

I am new to Lanterna and evaluating it for possible use in several projects.  I have a couple of probably easy questions but the documentation, while a good and simple intro, does not go into enough depth to address.

Basically we have a bunch of mature text applications (plain old Java, so nothing like cursor addressing) we'd like to upgrade to be much more full featured. The basic operation should be a terminal window and we want window popups (e.g. alt+F pulls up file dialog and inserts result at prompt). Rewriting the tools is really not much of an option, but augementing them and their function is. 

What I need is scrolling (page up and down -- can't get to work,reason for this post), command history (done), popup support (to do, want to be sure I'm on the right path first)

* Ideally: Is there a class that simply embeds  terminal window with either scroll bars or scrolling (page up down) into a GUI? 

* How to use the scrollLines call? I can get it to work but it of course erases the screen as it goes. This means things get erased. Am I missing some refresh feature to get the lines from the back buffer? If the user cannot move around their history this method seems not too useful and just a fancy way to clear the screen.

* Cutting text and pasting it into my current example is really, really slow -- like a few characters per second. Is this normal?



Martin Berglund

May 31, 2020, 2:05:50 AM5/31/20
Hi Jeff,
To answer your questions, you should probably look at the GUI layer. Lanterna has three conceptual layers, where the lowest deals directly with the terminal without any state, the middle layer has a "buffer" of the content on screen and lets you do bitmap-like interactions and then finally the third layer is a UI implementation. If you want scrollable text areas, there is a TextBox component in the UI layer that can do this. But if you want to keep things simple and not use the UI layer, you'll have to implement scrolling yourself by maintaining state that you copy into the Screen buffer based on what should currently be visible. The scrollLines call is probably not what you're looking for.


Det här meddelandet skickas till dig eftersom du prenumererar på gruppen "lanterna-discuss" i Google Grupper.
Om du vill sluta prenumerera på den här gruppen och inte längre få någon e-post från den skickar du ett e-postmeddelande till
Om du vill visa den här diskussionen på webben besöker du
Reply all
Reply to author
0 new messages