Skip to content

Instantly share code, notes, and snippets.

@khardix
Created April 18, 2016 19:08
Show Gist options
  • Save khardix/c0203caba93a7beb8e735286ab9a801e to your computer and use it in GitHub Desktop.
Save khardix/c0203caba93a7beb8e735286ab9a801e to your computer and use it in GitHub Desktop.
Basic scala/swing HelloWorld application with gradle
plugins {
id 'scala'
id 'com.github.johnrengelman.shadow' version '1.2.3'
}
repositories {
mavenCentral()
}
dependencies {
compile 'org.scala-lang:scala-library-all:2.11.5'
compile 'org.scala-lang.modules:scala-swing_2.11:1.0.1'
}
def mainClassName = 'cz.khardix.scala.HelloWorld'
jar.manifest.attributes 'Main-Class': mainClassName
task run(type: JavaExec, dependsOn: classes) {
main = mainClassName
classpath sourceSets.main.runtimeClasspath
classpath configurations.runtime
}
package cz.khardix.scala
import swing._
object HelloWorld extends SimpleSwingApplication {
def top = new MainFrame {
title = "Hello World!"
contents = new Button {
text = "Click Me!"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment