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
4
votes
3 answers

Java Lanterna - how can I get input from a textbox?

I'm a relatively new Java programmer (about two months experience) and I can't figure out how to get the data inputted into a Lanterna (a library for creating terminal user interfaces) textbox into a string for later use. Here is my…
user3529045
3
votes
2 answers

Threads not working with Laterna

I have a Lanterna terminal app. With threads I would like to fill up a window with different Panels and read key input accordingly. Using: thread1 = new ModuleThreads(screen,"Locations","addRightPanel"); thread2 = new…
Peter-TI
  • 91
  • 8
3
votes
1 answer

Resize clojure-lanterna terminal/screen from code

I'm toying around with clojure-lanterna but haven't found a way to resize the terminal/screen from code. Even in lanterna itself so far I haven't found a way to accomplish this. I need this functionality because I need a certain size and to put it…
jjpe
  • 664
  • 4
  • 13
2
votes
0 answers

working with long strings in lanterna Text GUI as INPUT/OUTPUT

it try whith textbox like this: BasicWindow window = new BasicWindow(); Panel contentPanel = new Panel(new GridLayout(1)); contentPanel.addComponent(new Label("one line Textbox")); contentPanel.addComponent( new TextBox() …
Ddll
  • 85
  • 8
1
vote
0 answers

lanterna how do i change the Font Size?

I'm trying for 3 days now to change the font size in laterna because it's so small in the console that it's unreadable in the api I can only get SwingTerminalFontConfiguration.newinstance(....); So I tried to just use (new Font) but it didn't change…
FundyJo
  • 11
  • 1
1
vote
0 answers

Is there a way to change font in your java code and write it to the console

Im making a pacman game in console. My idea was to create map and mobs just by using chars. There is no problem with the walls or the collection point, because there I can use chars which are in a default font. However, the problem starts when I…
BabyYoda
  • 31
  • 4
1
vote
1 answer

Lanterna- how do you create a simple CheckBox menu?

So far I have Terminal terminal = new DefaultTerminalFactory().createTerminal(); TerminalScreen screen = new TerminalScreen(terminal); MultiWindowTextGUI mwtg = new MultiWindowTextGUI​(screen); CheckBoxList checkBoxList = new…
George S.
  • 21
  • 2
1
vote
1 answer

lanterna.InputProvider.pollInput() crashes the application on launch while readInput() does not and works as expected

I am using lanterna to build a front end for my application and it requires a non-blocking input method so the displayed data can continuously refresh. for some reason the method for non-blocking input (pollInput) crashes on calling while the…
1
vote
3 answers

Code runs inside IDE but fails outside

I am trying to run an example code with Java Lanterna for a terminal GUI. Running the example within Netbeans 8.2 IDE successfully runs (essentially klicking the 'Play' button), but running the JAR file from the Linux terminal…
Socrates
  • 8,724
  • 25
  • 66
  • 113
1
vote
0 answers

How to center JFrame produced Lanterna, on the screen in Java?

I want the JFrame that is produced by Lanterna, to be centered on the screen, instead of being in the top-left corner. DefaultTerminalFactory defaultTerminalFactory = new DefaultTerminalFactory(); …
1
vote
1 answer

Lanterna 3. How can i get keypad inputs like enter or F1?

How can i get keypad inputs like enter or F1? I need to get the textbox content after the enter key is pressed. I need to get too the F1 and other keys in whatever moment. public static void main(String[] args) throws IOException,…
1
vote
1 answer

lanterna terminal input keeps repeating

I 'm making a simple java text-based hangman with lanterna (mainly becouse of clearscreen and user input in a console). I have a problem with my user input: Once I typed in my input and run it trough my code, it keeps using that same input every…
1
vote
1 answer

How to import Lanterna package to Java in Eclipse

I'm a programmer with little knowledge about programming, but I wanted to import the package for Lanterna (a gui console library) called com.googlecode.lanterna.terminal But when I do import com.googlecode.lanterna.terminal; It says it resolved to…
dumpong
  • 151
  • 12
1
vote
1 answer

Segmentation Fault in JNI AttachCurrentThread

Hope you have a good day today. I have a JNI so library with some of following codes. static JavaVM * s_vm = NULL; // The VM pointer // The following exported method is called by JVM when this so is loaded JNIEXPORT jint JNICALL…
Mr.Wang from Next Door
  • 13,670
  • 12
  • 64
  • 97
1
vote
1 answer

Lanterna SwingTerminal won't show

I'm on Windows using NetBeans IDE and lanterna. I try to create a SwingTerminal, but it won't show. public static void main(String[] args) throws Exception { SwingTerminal t = TerminalFacade.createSwingTerminal(); while (true) { …
Niklas R
  • 16,299
  • 28
  • 108
  • 203
1
2 3