Skip to content

Alipsa/GuiInteraction

Repository files navigation

GuiInteraction

A library providing GUI interaction capabilities for Groovy applications, compatible with Gade.

Overview

GuiInteraction enables standalone Groovy applications to have the same user interaction capabilities as when running in Gade. Choose the implementation that fits your environment:

Module UI Technology JDK Requirements Best For
gi-fx JavaFX JDK with JavaFX (e.g., BellSoft Liberica Full) Rich desktop apps
gi-swing Swing Any JDK 21+ Cross-platform desktop apps
gi-console Console/Text Any JDK 21+ Terminal and Headless/CI environments

Features

  • File and directory choosers
  • User prompts (text, password, selections)
  • Date and year-month pickers
  • HTML and Markdown content viewing
  • Table/Matrix display
  • Clipboard operations
  • Content type detection (via Apache Tika)
  • Resource loading utilities

Quick Start

Gradle

dependencies {
    implementation 'se.alipsa.gi:gi-swing:0.2.0'  // or gi-fx, gi-console
}

Maven

<dependency>
    <groupId>se.alipsa.gi</groupId>
    <artifactId>gi-swing</artifactId>
    <version>0.2.0</version>
</dependency>

Groovy Script with Grape

@Grab(group:'se.alipsa.gi', module:'gi-swing', version:'0.2.0')
import se.alipsa.gi.swing.InOut

def io = new InOut()
def file = io.chooseFile("Choose a file", ".", "Pick a file please!")
println("File chosen was $file")

Gade Compatibility

Scripts can run both in Gade and standalone by checking for the io variable:

// This makes the code run equally in Gade and in a standalone Groovy script
if (!binding.hasVariable('io')) {
    @Grab(group:'se.alipsa.gi', module:'gi-swing', version:'0.2.0')
    import se.alipsa.gi.swing.InOut
    binding.setVariable('io', new InOut())
}

def file = io.chooseFile("Choose a file", ".", "Pick a file please!")
println("File chosen was $file")

Documentation

Building from Source

./gradlew build

Requirements

  • JDK 21 or later
  • For gi-fx: JDK with JavaFX support (e.g., BellSoft Liberica Full JDK)

License

MIT License - see LICENSE

About

Allows Gade Gui Interactive capabilities from a standalone app

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •