Questions tagged [lanterna]

A Java library easing the job of creating a terminal application in Java by providing an AWT/Swing like stack.

Lanterna is a Java library allowing you to write easy semi-graphical user interfaces in a text-only environment, very similar to the C library curses but with more functionality. Lanterna is supporting xterm compatible terminals and terminal emulators such as konsole, gnome-terminal, putty, xterm and many more. One of the main benefits of lanterna is that it's not dependent on any native library but runs 100% in pure Java.

Also, when running Lanterna on computers with a graphical environment (such as Windows or Xorg), a bundled terminal emulator written in Swing will be used rather than standard output. This way, you can develop as usual from your IDE (most of them doesn't support ANSI control characters in their output window) and then deploy to your headless server without changing any code.

Lanterna is structured into three layers, each built on top of the other and you can easily choose which one fits your needs best.

  1. The first is a low level terminal interface which gives you the most basic control of the terminal text area. You can move around the cursor and enable special modifiers for characters put to the screen. You will find these classes in package com.googlecode.lanterna.terminal.
  2. The second level is a full screen buffer, the whole text screen in memory and allowing you to write to this before flushing the changes to the actual terminal. This makes writing to the terminal screen similar to modifying a bitmap. You will find these classes in package com.googlecode.lanterna.screen.
  3. The third level is a full GUI toolkit with windows, buttons, labels and some other components. It's using a very simple window management system (basically all windows are modal) that is quick and easy to use. You will find these classes in package com.googlecode.lanterna.gui.
35 questions
1
vote
2 answers

java lanterna can not read input from terminal

I have problems using the readInput() method from the lanterna package. My codefraction Terminal terminal = TerminalFacade.createSwingTerminal(); terminal.enterPrivateMode(); Key key = terminal.readInput(); …
bacc
  • 33
  • 1
  • 4
1
vote
1 answer

Unable to start a Java/Lanterna program

I'm currently writing a small terminal application, using what I find a very cool Java library : Lanterna. it allows me to write ncurses-like application using similar concepts to Swing. As that application ultumate goal is to be run on servers, I…
Riduidel
  • 22,052
  • 14
  • 85
  • 185
0
votes
0 answers

How to correctly toggle updates on my Java GUI (Lanterna)

I'm currently writing a GUI using the Lanterna library. Currently, I'm developing a GUI which must contain several components that display info of a given type Note. The code renders the GUI, but, the removeNoteFromList method doesn't seem to be…
gabriel_tiso
  • 1,007
  • 3
  • 11
  • 27
0
votes
0 answers

Copy textbox to clipboard in lanterna, putty environment, linux, redhat 6.10

I tried to copy the textbox but when it is long it gets cut off, I tried to make changes in the code: public class DefaultTerminalFactory implements TerminalFactory { public DefaultTerminalFactory(OutputStream outputStream, InputStream inputStream,…
Ddll
  • 85
  • 8
0
votes
1 answer

Using ProgressBar in Java Lanterna

I tried to use ProgressBar as below: ProgressBar Prog=new ProgressBar(0,100,50); Prog.setValue(0) // BufferedReader bf = new BufferedReader(new FileReader(file1)); String line = bf.readLine(); while (line != null) { …
Ddll
  • 85
  • 8
0
votes
1 answer

Lanterna - How to make a TextBox scroll to the bottom upon adding more text

I am creating a basic terminal chat application in Java using Lanterna. I have a TextBox component that I call addLine() on as new messages come in. The default behavior of a TextBox appears to be to maintain its previous scroll position until the…
Andrew
  • 61
  • 7
0
votes
0 answers

How to call Lanterna class to my UserInterface Class?

currently what I'm doing is using javac Main.java and the javac -cp lanterna.jar text.java to make them appear. I want it so that when I do something in my UserInterface.class the lanterna class will appear. Here is my…
sqpl13
  • 15
  • 2
0
votes
1 answer

How to run lanterna project in windows cmd?

I'm having trouble understanding what is missing/what to install to be able to compile my code in cmd. It works in IntelliJ IDE, and I've seen a similar question asked, but could not grasp the answer about using "fat jars" and maven…
0
votes
1 answer

Intellij building broken JAR artifact

I am trying to build a JAR artifact for my project which relies on one external library nbvcxz and one imported library lanterna: When adding the JAR under Artifacts in Project Structure, JAR -> from modules with dependencies is used: The…
0
votes
1 answer

Reading all currently pressed keys in Clojure

Is there a way of getting a list of all currently pressed keys in a Lanterna Terminal/Screen? i.e. not getting the last pressed key, neither waiting for a key to be pressed. I'd like to get a list of all keys that are currently being held down. I…
Ezequiel
  • 668
  • 2
  • 9
  • 25
0
votes
1 answer

What do I need to compile this lanterna maven project from terminal?

I'm following a simple lanterna demo tutorial using maven. The problem is that the program runs perfectly using IDE intellij, but wont compile from terminal. Do I need to include something more in my pom.xml file? My file Rouge.java opens a simple…
F Wi
  • 139
  • 5
0
votes
1 answer

How do you create a custom button in lanterna?

I've created a simple terminal app using lanterna that simply displays a custom button. But even though in the custom button's class I extend the Button class and override the Button class' createDefaultRenderer method to return an instance of the…
eric.mcgregor
  • 3,507
  • 2
  • 16
  • 16
0
votes
1 answer

ArrayIndexOutOfBoundsException using GridLayout with lanterna

I'm experiementing with lanterna's 4th tutorial. When I create a GridLayout with 2 columns and add 2 Labels that each span the 2 columns the program runs without errors. But when I make a GridLayout with 4 columns and add 2 Labels that span the 4…
eric.mcgregor
  • 3,507
  • 2
  • 16
  • 16
0
votes
0 answers

Lanterna Groovy SwingBuilder

Is there any way I can use lanterna in Groovy using SwingBuilder? Or at least something similar? I like Groovy, and I would like to use it to make a command line app, but it would be nice if it were concise and in Groovy.
perryprog
  • 111
  • 2
  • 13
0
votes
1 answer

IntelliJ Idea LanternaGriffon Doesn't Recognize Griffon Project

I just made my first Griffon project, using lazybones. I chose griffon-lanterna-groovy for my template, and I then removed pom.xml and maven/ as I will be using Gradle. I then run gradle build test run and everything looked good. (it ran, build…
perryprog
  • 111
  • 2
  • 13