Skip to content

Instantly share code, notes, and snippets.

@crevier
crevier / cliQuestion.groovy
Created June 15, 2018 11:24
simple stdin option selection in groovy
void displayOptions(String name, List<String> options) {
print("Select $name ::")
options.eachWithIndex { String entry, int i ->
print(" $entry [${i + 1}]${i + 1 == options.size() ? ": " : ","}")
}
}
int readUserInput(List<String> options) {
displayOptions(options)
def input = ++new Scanner(System.in)
@crevier
crevier / checkListViewer.groovy
Created June 21, 2018 17:08
CheckList viewer in groovy
import javax.swing.*
import java.awt.*
import java.nio.file.Path
import java.nio.file.Paths
import java.util.List
import static javax.swing.JOptionPane.*
/*
Display a checklist selected from a folder and write the user selection in a log file
@crevier
crevier / swingTimer.groovy
Created July 3, 2018 14:12
Simple swing timer in groovy
import javax.swing.JDialog
import javax.swing.JPanel
import java.awt.*
import java.awt.image.BufferedImage
import static java.lang.System.exit
import static javax.swing.JOptionPane.*
class TimerPanel extends JPanel {