Lanterna 3 is a large, and probably final, update to the Lanterna library. Many parts have been completely rewritten and the parts not rewritten have been touched in at least some way. The reason for this major overhaul is to finally get it 'right' and fix all those API mistakes that have been highlighted over the years since Lanterna was first published.
This section can in no way summarize all the changes but will try to highlight some of the new features and redesigns. Please note that Lanterna 3 is not API compatible with Lanterna 2.X and earlier.
NOTE: Lanterna 3 is still under development. The majority of the features below are implemented but not all.
SwingTerminal: SwingTerminal in Lanterna 2.X was limited in many ways. For Lanterna 3.0 some of those limitations have been addressed. The actual class is no longer a JFrame but a JComponent, meaning you can easily embed it into any Swing application. Furthermore, it does not require to be run in private mode anymore. You can switch between normal and private mode as you like and it will keep track of the content. Additionally, it finally supports a backlog history and scrolling. A helper class, ScrollingSwingTerminal, can easily get you started with this. If you want the classic behaviour there is SwingTerminalFrame which behaves much like SwingTerminal used to.ScreenWriter now supports not just text and filled rectangles but also lines and both filled and unfilled triangles.Screen an interface and cleaned up its API. The default implementation behaves like Screen used to with improvements such as full color supportTextBox now accepts input of non-Latin charactersKeyMappingProfile patterns now publicTextBox components (other than space)SwingTerminal function key supportInputDecoder fixes backported from master branchAbstractListBox and its subclassesLayoutParameter constructor to public, making it easier to create custom layout managersTextArea crash on pressing End when horizontal size is too bigScreen will drain the input queue upon exitingTextArea, a user-contributed componentScreen.updateScreenSize() to manually check and update internal data structures, allowing you to redraw the screen before calling Screen.refresh()Key.equals(...) and Key.hashCode() methodsTerminalPosition.equals(...) and TerminalPosition.hashCode() methodsGUIScreenActionListBox has a new parameter that closes the dialog before running the selected ActionSwingTerminal AWT threading fixesScreen buffer and force a complete redrawGUIScreen to make it easier to extendScreenTable APIRadioCheckBoxList.getCheckedItem()SwingTerminal is reduced to 0 rowsActionListDialog now increases in size as you add itemsTextBox can now tell you the current edit cursor positionGUIScreen.closeWindow() (as deprecated)Panel.setBetweenComponentsPadding(...) (as deprecated)AbstractListBox now follow the preferred size override correctlyActivityIndicatorSwingTerminal to mimic the appearance of several popular terminal emulatorsBorderLayout layout managedGUIScreen backgrounds can now be customizedWindow.close() instead of GUIScreen.closeWindow(...)SwingTerminal now uses a new class, TerminalAppearance, to retrieve the visual settings, such as fonts and colours2.1.X is not strictly API compatible with 2.0.X but compared to going from 1.0.X to 2.0.X there will be fewer API breaking changes
TextArea componentTable will trigger the screen to redrawRadioCheckBoxListTextArea can now be modified (experimental feature)There is no 2.0.2. I did a mistake staging the new release and had to start over again but 2.0.2 had already been tagged in Mercurial so I could not re-release it. Instead we skipped a number and landed on 2.0.3
Screen.clear() that allows resetting the content of the screenTerminal.getTerminalSize() to synchronously retrieve the current size of the terminalSwingTerminalSwingTerminal will now render underlined textSwingTerminal will expose its internal JFrame through a new method getJFrame(), allowing you to set a custom title, icon, image list etc.queryTerminalSize() has been marked as deprecated but will still work as beforeTextBox and PasswordBox constructors that did not take a width parameter were broken, fixed and changed so that the initial size (unless forced) will be at least 10 columns wideTerminalFacade, which provides some convenience methods for creating terminal objectsInteractable.Result and Interactable.FocusChangeDirection to allow focus switching in four directions instead of only twoAbstractListBox which has standardized the format and the methods of the list-based GUI elementscom.googlecode.lanterna.TerminalFactory to com.googlecode.lanterna.terminal where it belongs~~Terminal.addInputProfile(...) to InputProviderTerminal.Style to an outer class in com.googlecode.lanterna.screenSwingTerminal to com.googlecode.lanterna.terminal.swingTerminal.setCBreak(...) and Terminal.setEcho(...) into ANSITerminal. You probably don't need to call these directly anyway, since they are automatically called for the UnixTerminal when entering private modeTerminal hierarchy. This is mostly internal but you might have been using CommonUnixTerminal before which is now known as com.googlecode.lanterna.terminal.text.UnixTerminalorg.lantern to com.googlecode.lanternaLanternException to LanternaException for consistencyLanternaException is now a RuntimeException since IOExceptions coming from stdin and stdout are quite rareTheme. You probably will not be affected by this unless you have defined your own themeLanternTerminal and TerminalFactory as they were quite confusing and not really necessaryListBox as there is not much purpose for it in this environmentRadioCheckBox and RadioCheckBoxGroup. RadioCheckBoxList acts as a replacementTermInfo classes (they did not really work so hopefully no one was using them)Starting with the 2.0.0 release, Lanterna has been using Maven and the Sonatype OSS repository which is synchronized with Maven Central. Please see the Maven information page for more details
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |