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
0
votes
0 answers

Rhythm game in a functional language

I want to make a vertically scrolling rhythm game (even something basic with one lane) in Clojure using play-clj (or maybe clojure-lanterna because responsive TUI apps are neat and it works on Windows) I don't really know how you can represent a…
ohmree
  • 375
  • 3
  • 15
0
votes
1 answer

No TerminalFacade for lanterna - Java

No TerminalFacade for lanterna - Java Eclipse gets me this error TerminalFacade cannot be resolved For this code Terminal terminal = TerminalFacade.createTerminal(System.in, System.out, Charset.forName("UTF8")); I have looked in the source files…
user5644457
0
votes
1 answer

Java lanterna Terminal put in java.properties file?

I'm quite new to programming (had it for a Semester now) and I'm supposed to use the Lanterna Libary (in my final project) to make a terminal in which I can run later a very simple Maze game with walls and static and dynamic "enemies" as well as…
0
votes
1 answer

Lanterna: Page up / Page down

Is it possible to capture page up and page down keys using Lanterna? I'm creating a (specialized) hex editor in Java and thought that it would be a good idea to integrate terminal / curses support as well. If it isn't possible, is it possible in one…
Maarten Bodewes
  • 90,524
  • 13
  • 150
  • 263
0
votes
1 answer

Java lanterna - Cannot read user input

I have problems with reading user input from java lanterna library terminal. Upon key strike I would like the system to print a certain character on the terminal. I use this code: public class Snake { public static void main(String[] args) { …
1 2
3