Skip to content

Instantly share code, notes, and snippets.

@rladstaetter
rladstaetter / JavaFXExampleSpec.scala
Last active December 10, 2015 14:18
JemmyFX Test for JavaFX using Scala and ScalaTest
package org.example.scalajfx
import org.scalatest.matchers.ShouldMatchers
import org.scalatest.FlatSpec
import org.jemmy.fx.SceneDock
import org.jemmy.fx.AppExecutor
import org.jemmy.fx.control.ToggleButtonDock
import org.jemmy.fx.control.LabeledDock
class JavaFXExampleSpec extends FlatSpec with ShouldMatchers {
package net.ladstatt.apps.watersimulation
import javafx.application.Application
import javafx.fxml.FXML
import javafx.fxml.FXMLLoader
import javafx.fxml.Initializable
import javafx.fxml.JavaFXBuilderFactory
import javafx.scene.Parent
import javafx.scene.Scene
import javafx.scene.layout.StackPane
@rladstaetter
rladstaetter / WaterSimulation.scala
Created January 10, 2013 21:53
A simple Scala program using JavaFX to show a simple water simulation in 2D
package net.ladstatt.apps.watersimulation
import scala.collection.JavaConversions.seqAsJavaList
import javafx.animation.Animation
import javafx.animation.KeyFrame
import javafx.animation.Timeline
import javafx.application.Application
import javafx.event.ActionEvent
import javafx.event.EventHandler
@rladstaetter
rladstaetter / PlantSomeTrees.scala
Created January 12, 2013 13:25
A scala powered JavaFX application which paints some trees on a canvas.
package net.ladstatt.apps
import scala.collection.JavaConversions.seqAsJavaList
import scala.math.Pi
import scala.math.cos
import scala.math.sin
import scala.util.Random
import javafx.application.Application
import javafx.event.EventHandler
@rladstaetter
rladstaetter / GrowingTrees.scala
Created January 13, 2013 19:11
A followup to the PlantSomeTrees.scala gist, see my blog for more information.
package net.ladstatt.apps
import scala.collection.JavaConversions.seqAsJavaList
import scala.math.Pi
import scala.math.cos
import scala.math.sin
import scala.util.Random
import javafx.animation.Animation
import javafx.animation.KeyFrame
@rladstaetter
rladstaetter / build.xml
Created January 21, 2013 20:59
An example for calling ant from maven using a property file for storing values
<project default="main">
<target name="main">
<echo message="This line is executed in an external build.xml for javafx version: ${javafx.version}"/>
</target>
</project>
@rladstaetter
rladstaetter / JaggedLine.scala
Created January 23, 2013 21:17
creates a jagged line using JavaFX
class JaggedLine extends javafx.application.Application {
val canvasWidth = 1024
val canvasHeight = 768
val jaggingSections = 100
val jaggedFactor = 2
override def start(primaryStage: Stage): Unit = {
primaryStage.setTitle("Level1")
@rladstaetter
rladstaetter / GlowingLine.scala
Created January 23, 2013 21:19
A glowing line with JavaFX
class GlowingLine extends javafx.application.Application {
val canvasWidth = 1024
val canvasHeight = 768
override def start(primaryStage: Stage): Unit = {
primaryStage.setTitle("Level0")
val root = new BorderPane()
val drawingBoard = new Group()
val background = {
@rladstaetter
rladstaetter / GameOfLife.scala
Last active December 12, 2015 06:08
Conway's Game of Life - in Scala with JavaFX
package net.ladstatt.apps
import scala.collection.JavaConversions.asScalaBuffer
import scala.collection.JavaConversions.seqAsJavaList
import scala.util.Random
import javafx.animation.Animation
import javafx.animation.KeyFrame
import javafx.animation.Timeline
import javafx.application.Application
@rladstaetter
rladstaetter / SphereAndBox.scala
Last active December 14, 2015 03:29
A simple JavaFX 3D Demo using scala
package net.ladstatt.apps
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided