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.
- Proper support for CJK characters and handling of them
- New GUI system: The old GUI system has been deprecated and a new one is replacing it, giving you much more control over how you want your GUI to look. You can do any kind of old-school interface, not just dialog-based ones and even things like multi-tasking windows if you like. Please note that this is currently under development.
- New
SwingTerminal:SwingTerminalin 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 aJFramebut aJComponent, 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 isSwingTerminalFramewhich behaves much likeSwingTerminalused to. - Telnet server: In addition to the terminal implementations that have been around since the earlier builds of Lanterna, version 3 introduces a Telnet server class that allows you to program multiple terminals against clients connecting in through standard Telnet. A small subset of the Telnet protocol is implemented so far, however, it supports features such as window resizing, line mode setting and echo control.
ScreenWriternow supports not just text and filled rectangles but also lines and both filled and unfilled triangles.
- Made
Screenan interface and cleaned up its API. The default implementation behaves likeScreenused to with improvements such as full color support - The code and API more closely follows Java conventions on naming and style
- Better ESC key detection
- Enable EOF 'key' when the input stream is closed (requires setting system property 'com.googlecode.lanterna.enable-eof' to 'true')
TextBoxnow accepts input of non-Latin characters
- Better ESC key detection
- Regression fixed with high CPU load when opening a window with no interactable components
KeyMappingProfilepatterns now public
- Ability to set the fill character of
TextBoxcomponents (other than space) - Ability to disable shadows for windows
- Added a file dialog component
- Added a method to make it easier to wrap components in a border
- Added
SwingTerminalfunction key support - Window-deriving classes can inspect which component has input focus
- Input focus bug fixes
InputDecoderfixes backported from master branch
- Added support for the PageUp, PageDown, Home and End keys inside
AbstractListBoxand its subclasses
- Change visibility of
LayoutParameterconstructor to public, making it easier to create custom layout managers - Fixed
TextAreacrash on pressing End when horizontal size is too big - Miscellaneous bug fixes
- Terminals will remember if they are in private mode and will not attempt to enter twice
Screenwill drain the input queue upon exiting
- Added an experimental
TextArea, a user-contributed component - Added
Screen.updateScreenSize()to manually check and update internal data structures, allowing you to redraw the screen before callingScreen.refresh() - Proper
Key.equals(...)andKey.hashCode()methods - Proper
TerminalPosition.equals(...)andTerminalPosition.hashCode()methods
- Fixed a deadlock in
GUIScreen ActionListBoxhas a new parameter that closes the dialog before running the selectedActionSwingTerminalAWT threading fixes
- Added a new method to invalidate the
Screenbuffer and force a complete redraw
- Visibility changed on
GUIScreento make it easier to extend
- Customization of screen padding character
- More input key combinations detecting ALT down
- Background color fix with
Screen - Expanded
TableAPI - Improved (but still incomplete) CJK character handling
- OS X input compatibility fix
RadioCheckBoxList.getCheckedItem()
- Enhanced restoration of the terminal control codes (especially on Solaris)
- Fixed a bug that occurred when
SwingTerminalis reduced to 0 rows - Fixed a bug that prevented the cursor from becoming visible again after leaving private mode
ActionListDialognow increases in size as you add itemsTextBoxcan now tell you the current edit cursor position
- Re-added
GUIScreen.closeWindow()(as deprecated) - Re-added
Panel.setBetweenComponentsPadding(...)(as deprecated)
- Owner window can now be correctly derived from a component
- Classes extending
AbstractListBoxnow follow the preferred size override correctly
- Added a new component,
ActivityIndicator - Added support for showing and hiding the text cursor
- Included ANSI colour palettes for the
SwingTerminalto mimic the appearance of several popular terminal emulators - Introduced the
BorderLayoutlayout managed - Support 8-bit and 24-bit colours (not supported by all terminal emulators)
- Support detection of CTRL and ALT key status
GUIScreenbackgrounds can now be customized
- Close windows using
Window.close()instead ofGUIScreen.closeWindow(...) - Generalized component alignment
- GUI windows can now be display in full-screen mode, taking up the entire terminal
- Lots of bug fixes
- Reworked GUI layout system
- Reworked the theme system
- Window size is overridable
SwingTerminalnow uses a new class,TerminalAppearance, to retrieve the visual settings, such as fonts and colours
- Removed dependencies on proprietary Sun API
2.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
- The PageUp, PageDown, Home, and End keys now work in the
TextAreacomponent
- Adding rows to a
Tablewill trigger the screen to redraw - Improved API for
RadioCheckBoxList
- Added experimental support for F1-F12 keys
TextAreacan now be modified (experimental feature)
- Font fixes. Hopefully it will look better on Linux now
- Invisible components no longer receive focus
- The size policies are working better now but they are still somewhat mysterious. I will try to come up with something better for the 2.1.0 release
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
- Added
Screen.clear()that allows resetting the content of the screen - Added
Terminal.getTerminalSize()to synchronously retrieve the current size of the terminal - Added new overloads so that you can specify a separate font to use for bold text in
SwingTerminal SwingTerminalwill now render underlined textSwingTerminalwill expose its internalJFramethrough a new methodgetJFrame(), allowing you to set a custom title, icon, image list etc.
queryTerminalSize()has been marked as deprecated but will still work as beforeTextBoxandPasswordBoxconstructors 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 wide
- Added a new facade class,
TerminalFacade, which provides some convenience methods for creating terminal objects - Added experimental, but not very functional, support for Cygwin
- Expanded
Interactable.ResultandInteractable.FocusChangeDirectionto allow focus switching in four directions instead of only two - Introduced
AbstractListBoxwhich has standardized the format and the methods of the list-based GUI elements - Mavenized the project, will try to push it to Maven Central somehow
Movedcom.googlecode.lanterna.TerminalFactorytocom.googlecode.lanterna.terminalwhere it belongs- Moved
Terminal.addInputProfile(...)toInputProvider - Moved
Terminal.Styleto an outer class incom.googlecode.lanterna.screen - Moved
SwingTerminaltocom.googlecode.lanterna.terminal.swing - Moved
Terminal.setCBreak(...)andTerminal.setEcho(...)intoANSITerminal. You probably don't need to call these directly anyway, since they are automatically called for theUnixTerminalwhen entering private mode - Rearranged the
Terminalhierarchy. This is mostly internal but you might have been usingCommonUnixTerminalbefore which is now known ascom.googlecode.lanterna.terminal.text.UnixTerminal - Renamed the project's package name from
org.lanterntocom.googlecode.lanterna - Renamed
LanternExceptiontoLanternaExceptionfor consistency LanternaExceptionis now aRuntimeExceptionsinceIOExceptions coming from stdin and stdout are quite rare- Renamed some enums and an internal class in
Theme. You probably will not be affected by this unless you have defined your own theme
- Removed
LanternTerminalandTerminalFactoryas they were quite confusing and not really necessary - Removed
ListBoxas there is not much purpose for it in this environment - Removed
RadioCheckBoxandRadioCheckBoxGroup.RadioCheckBoxListacts as a replacement - Removed
TermInfoclasses (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