TerminalFactory
public class DefaultTerminalFactory extends Object implements TerminalFactory
Note that for all systems with a graphical environment present, the SwingTerminalFrame will be chosen. You can suppress this by calling setForceTextTerminal(true) on this factory.
Constructor | Description |
---|---|
DefaultTerminalFactory() |
Creates a new DefaultTerminalFactory with all properties set to their defaults
|
DefaultTerminalFactory(OutputStream outputStream,
InputStream inputStream,
Charset charset) |
Creates a new DefaultTerminalFactory with I/O and character set options customisable.
|
Modifier and Type | Method | Description |
---|---|---|
DefaultTerminalFactory |
addTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) |
Adds an auto-close trigger to use on created SwingTerminalFrames created by this factory
|
AWTTerminalFrame |
createAWTTerminal() |
|
TerminalScreen |
createScreen() |
Create a
Terminal and immediately wrap it up in a TerminalScreen |
SwingTerminalFrame |
createSwingTerminal() |
|
TelnetTerminal |
createTelnetTerminal() |
Creates a new TelnetTerminal
Note: a telnetPort should have been set with setTelnetPort(),
otherwise creation of TelnetTerminal will most likely fail.
|
Terminal |
createTerminal() |
Instantiates a Terminal according to the factory implementation.
|
Terminal |
createTerminalEmulator() |
Creates a new terminal emulator window which will be either Swing-based or AWT-based depending on what is
available on the system
|
DefaultTerminalFactory |
setAutoOpenTerminalEmulatorWindow(boolean autoOpenTerminalFrame) |
Controls whether a SwingTerminalFrame shall be automatically shown (.setVisible(true)) immediately after
creation.
|
DefaultTerminalFactory |
setForceAWTOverSwing(boolean forceAWTOverSwing) |
Normally when a graphical terminal emulator is created by the factory, it will create a
SwingTerminalFrame unless Swing is not present in the system. |
DefaultTerminalFactory |
setForceTextTerminal(boolean forceTextTerminal) |
Controls whether a text-based Terminal shall be created even if the system
supports a graphical environment
|
DefaultTerminalFactory |
setInitialTerminalSize(TerminalSize initialTerminalSize) |
Sets a hint to the TerminalFactory of what size to use when creating the terminal.
|
DefaultTerminalFactory |
setInputTimeout(int inputTimeout) |
Only for StreamBasedTerminals: After seeing e.g. an Escape (but nothing
else yet), wait up to the specified number of time units for more
bytes to make up a complete sequence.
|
DefaultTerminalFactory |
setMouseCaptureMode(MouseCaptureMode mouseCaptureMode) |
Sets the mouse capture mode the terminal should use.
|
DefaultTerminalFactory |
setPreferTerminalEmulator(boolean preferTerminalEmulator) |
Controls whether a Swing or AWT TerminalFrame shall be preferred if the system
has both a Console and a graphical environment
|
DefaultTerminalFactory |
setTelnetPort(int telnetPort) |
Primarily for debugging applications with mouse interactions:
If no Console is available (e.g. from within an IDE), then fall
back to TelnetTerminal on specified port.
|
DefaultTerminalFactory |
setTerminalEmulatorColorConfiguration(TerminalEmulatorColorConfiguration colorConfiguration) |
Sets the color configuration to use on created SwingTerminalFrames created by this factory
|
DefaultTerminalFactory |
setTerminalEmulatorDeviceConfiguration(TerminalEmulatorDeviceConfiguration deviceConfiguration) |
Sets the device configuration to use on created SwingTerminalFrames created by this factory
|
DefaultTerminalFactory |
setTerminalEmulatorFontConfiguration(AWTTerminalFontConfiguration fontConfiguration) |
Sets the font configuration to use on created SwingTerminalFrames created by this factory
|
DefaultTerminalFactory |
setTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger) |
Sets the auto-close trigger to use on created SwingTerminalFrames created by this factory.
|
DefaultTerminalFactory |
setTerminalEmulatorTitle(String title) |
Sets the title to use on created SwingTerminalFrames created by this factory
|
DefaultTerminalFactory |
setUnixTerminalCtrlCBehaviour(UnixLikeTerminal.CtrlCBehaviour unixTerminalCtrlCBehaviour) |
Sets the default CTRL-C behavior to use for all
UnixTerminal objects created by this factory. |
public DefaultTerminalFactory()
public DefaultTerminalFactory(OutputStream outputStream, InputStream inputStream, Charset charset)
outputStream
- Output stream to use for text-based Terminal implementationsinputStream
- Input stream to use for text-based Terminal implementationscharset
- Character set to assume the client is usingpublic Terminal createTerminal() throws IOException
TerminalFactory
createTerminal
in interface TerminalFactory
IOException
- If there was an I/O error with the underlying input/output systempublic Terminal createTerminalEmulator()
Terminal
interfacepublic AWTTerminalFrame createAWTTerminal()
public SwingTerminalFrame createSwingTerminal()
public TelnetTerminal createTelnetTerminal()
Terminal
interfacepublic DefaultTerminalFactory setInitialTerminalSize(TerminalSize initialTerminalSize)
initialTerminalSize
- Size (in rows and columns) of the newly created terminalpublic DefaultTerminalFactory setForceTextTerminal(boolean forceTextTerminal)
forceTextTerminal
- If true, will always create a text-based Terminalpublic DefaultTerminalFactory setPreferTerminalEmulator(boolean preferTerminalEmulator)
preferTerminalEmulator
- If true, will prefer creating a graphical terminal emulatorpublic DefaultTerminalFactory setUnixTerminalCtrlCBehaviour(UnixLikeTerminal.CtrlCBehaviour unixTerminalCtrlCBehaviour)
UnixTerminal
objects created by this factory. You can
use this to tell Lanterna to trap CTRL-C instead of exiting the application. Non-UNIX terminals are not affected
by this.unixTerminalCtrlCBehaviour
- CTRL-C behavior to use for UnixTerminal
:spublic DefaultTerminalFactory setTelnetPort(int telnetPort)
telnetPort
- the TCP/IP port on which to eventually wait for a connection.
A value less or equal 0 disables creation of a TelnetTerminal.
Note, that ports less than 1024 typically require system
privileges to listen on.public DefaultTerminalFactory setInputTimeout(int inputTimeout)
inputTimeout
- how long to wait for possible completions of sequences.
units are of a 1/4 second, so e.g. 12 would wait up to 3 seconds.public DefaultTerminalFactory setForceAWTOverSwing(boolean forceAWTOverSwing)
SwingTerminalFrame
unless Swing is not present in the system. Setting this property to true
will
make it create an AWTTerminalFrame
even if Swing is presentforceAWTOverSwing
- If true
, will always create an AWTTerminalFrame
over a
SwingTerminalFrame
if asked to create a graphical terminal emulatorpublic DefaultTerminalFactory setAutoOpenTerminalEmulatorWindow(boolean autoOpenTerminalFrame)
false
, you will manually need to call .setVisible(true)
on the JFrame to actually
see the terminal window. Default for this value is true
.autoOpenTerminalFrame
- Automatically open SwingTerminalFrame after creationpublic DefaultTerminalFactory setTerminalEmulatorTitle(String title)
title
- Title to use on created SwingTerminalFrames created by this factorypublic DefaultTerminalFactory setTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger)
null
, all triggers are cleared.autoCloseTrigger
- Auto-close trigger to use on created SwingTerminalFrames created by this factory, or null
to clear all existing triggerspublic DefaultTerminalFactory addTerminalEmulatorFrameAutoCloseTrigger(TerminalEmulatorAutoCloseTrigger autoCloseTrigger)
autoCloseTrigger
- Auto-close trigger to add to the created SwingTerminalFrames created by this factorypublic DefaultTerminalFactory setTerminalEmulatorColorConfiguration(TerminalEmulatorColorConfiguration colorConfiguration)
colorConfiguration
- Color configuration to use on created SwingTerminalFrames created by this factorypublic DefaultTerminalFactory setTerminalEmulatorDeviceConfiguration(TerminalEmulatorDeviceConfiguration deviceConfiguration)
deviceConfiguration
- Device configuration to use on created SwingTerminalFrames created by this factorypublic DefaultTerminalFactory setTerminalEmulatorFontConfiguration(AWTTerminalFontConfiguration fontConfiguration)
fontConfiguration
- Font configuration to use on created SwingTerminalFrames created by this factorypublic DefaultTerminalFactory setMouseCaptureMode(MouseCaptureMode mouseCaptureMode)
mouseCaptureMode
- Capture mode for mouse interactionspublic TerminalScreen createScreen() throws IOException
Terminal
and immediately wrap it up in a TerminalScreen
TerminalScreen
created with a terminal from createTerminal()
IOException
- In case there was an I/O errorCopyright © 2020. All rights reserved.