JavaFX Terminal Emulator
Table of Contents
1. JavaFX Terminal Emulator
2. Features
-
Multi OS (Mac, Win, *Nix) Support
-
Terminal Emulator (Xterm)
-
Copy and Paste Support
-
CygWin Support
-
Configurable (Color, Size, Font)
-
Multi Tab Support
3. Usage
Default Config
TerminalBuilder terminalBuilder = new TerminalBuilder();
TerminalTab terminal = terminalBuilder.newTerminal();
TabPane tabPane = new TabPane();
tabPane.getTabs().add(terminal);
Dark Config
TerminalConfig darkConfig = new TerminalConfig();
darkConfig.setBackgroundColor(Color.rgb(16, 16, 16));
darkConfig.setForegroundColor(Color.rgb(240, 240, 240));
darkConfig.setCursorColor(Color.rgb(255, 0, 0, 0.5));
TerminalBuilder terminalBuilder = new TerminalBuilder(darkConfig);
TerminalTab terminal = terminalBuilder.newTerminal();
TabPane tabPane = new TabPane();
tabPane.getTabs().add(terminal);
4. CygWin Support
TerminalConfig cygwinConfig = new TerminalConfig();
cygwinConfig.setWindowsTerminalStarter("C:\\cygwin64\\bin\\bash -i"); (1)
TerminalBuilder terminalBuilder = new TerminalBuilder(cygwinConfig);
TerminalTab terminal = terminalBuilder.newTerminal();
TabPane tabPane = new TabPane();
tabPane.getTabs().add(terminal);
-
Set bash in cygwin path
5. Maven Dependency
<!-- Add repository -->
<repositories>
<repository>
<id>terminalfx-repo</id>
<url>https://github.com/javaterminal/terminalfx/raw/master/releases</url>
</repository>
</repositories>
<!-- Add dependency for Java 17-->
<dependency>
<groupId>com.kodedu.terminalfx</groupId>
<artifactId>terminalfx</artifactId>
<version>1.2.0</version>
</dependency>
<!-- Add dependency for Java 8-->
<dependency>
<groupId>com.kodedu.terminalfx</groupId>
<artifactId>terminalfx</artifactId>
<version>1.0.8</version>
</dependency>
6. Compile & Run
git clone https://github.com/rahmanusta/TerminalFX
cd TerminalFX
mvn clean install
mvn javafx:run
7. Run as Java Module (Java 17)
The following modules have to be added in JVM parameters
--add-modules=javafx.controls,javafx.graphics
8. Run command
You can run commands:
terminal.onTerminalFxReady(() -> {
terminal.getTerminal().command("java -version\r");
});
9. Licence
This project is licensed under the MIT license. See LICENSE for more information.