Last active
December 11, 2015 02:19
-
-
Save timyates/4529776 to your computer and use it in GitHub Desktop.
A GroovyFX version of the Canoo JavaFX Abacus tutorial part ii
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.codehaus.groovyfx:groovyfx:0.3.1') | |
import static groovyx.javafx.GroovyFX.start | |
final int ROW_COUNT = 10 | |
final int COL_COUNT = 10 | |
final int RADIUS = 20 | |
final int DIAMETER = 2 * RADIUS | |
final int WIDTH = COL_COUNT * DIAMETER | |
final int HEIGHT = ROW_COUNT * DIAMETER | |
final int MOVE_WAY = 100 | |
start { | |
stage( title: 'GroovyFX Abacus', visible: true ) { | |
scene( width: WIDTH + MOVE_WAY, height: HEIGHT ) { | |
(0..<ROW_COUNT).each { int row -> | |
(0..<COL_COUNT).each { int column -> | |
circle( radius : RADIUS - 1, | |
centerX: RADIUS + ( column * DIAMETER ), | |
centerY: RADIUS + ( row * DIAMETER ), | |
onMouseClicked: { e -> | |
e.source.translateX = MOVE_WAY | |
} ) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The original JavaFX tutorial can be found here: http://www.canoo.com/blog/2013/01/14/javafx-abacus-tutorial-part-ii/