= Groovy =
 * https://groovy-lang.org/
 * http://groovy-lang.org/groovy-dev-kit.html
 * http://groovy-lang.org/objectorientation.html
Apache Groovy is a powerful, optionally typed and dynamic language, with static-typing and static compilation capabilities, for the Java platform aimed at improving developer productivity thanks to a concise, familiar and easy to learn syntax

== Install ==
{{{#!highlight sh
cd  ~/
wget https://groovy.jfrog.io/artifactory/dist-release-local/groovy-zips/apache-groovy-binary-4.0.26.zip 
unzip apache-groovy-binary-4.0.26.zip 

nano ~/.bashrc
# export GROOVY_HOME=$HOME/groovy-4.0.26
# export PATH=$PATH:$GROOVY_HOME/bin
. ~/.bashrc 
groovysh
# a = 1
# print("aaa $a")
# :q
groovyConsole
}}}

== groovyc - compiler ==
 * nano MyClass.groovy
{{{#!highlight groovy
class X{
  int amount
}

def x = new X()
x.amount = 1
println("${x.amount}")
}}}

{{{#!highlight sh
groovyc MyClass.groovy
java -cp . -jar $GROOVY_HOME/lib/groovy-3.0.3.jar   MyClass
java -jar $GROOVY_HOME/lib/groovy-3.0.3.jar   MyClass
}}}

== swing - groovy ==
{{{#!highlight groovy
import groovy.swing.SwingBuilder
import java.awt.BorderLayout as BL

count = 0

def actionPerformedFn(){
  count++; 
  textlabel.text = "Clicked ${count} time(s)."
  println "clicked"
}

def quitFn(){
  System.exit(0) 
}

new SwingBuilder().edt {
  frame(title: 'Frame', size: [300, 300], show: true) {
    borderLayout()
    textlabel = label(text: 'Click the button!', constraints: BL.NORTH)
    button(text:'Click Me', actionPerformed: {actionPerformedFn()}, constraints:BL.WEST)
    button(text:'Quit', actionPerformed: {quitFn()}, constraints:BL.EAST)
  }
}
}}}

{{{#!highlight sh
groovyc swing.groovy 
java -cp .:$GROOVY_HOME/lib/groovy-3.0.3.jar:$GROOVY_HOME/lib/groovy-swing-3.0.3.jar swing
}}}