• Stars
    star
    267
  • Rank 153,621 (Top 4 %)
  • Language
    Java
  • License
    MIT License
  • Created over 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java FX Terminal Emulator

JavaFX Terminal Emulator

1. JavaFX Terminal Emulator

TerminalFX is a terminal (PTY) emulator application written in JavaFX 18.

We use Pty4J to get VT codes from running process and hterm.js from Chromium project to interact with Pty4J. TerminalFX is using powerful JavaFX WebView component to run hterm.js.

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);
images\default
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);
images\dark

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);
  1. Set bash in cygwin path

images\cygwin

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.