Skip to content

Instantly share code, notes, and snippets.

View shemnon's full-sized avatar

Danno Ferrin shemnon

View GitHub Profile
// in a griffon view
// with the hypothetical TridentBuilder adding the animate node
frame( title: "Trident+Groovy", size: [400,200],
locationRelativeTo: null, visible: true ) {
flowLayout()
button = button("Sample",
foreground: animate([Color.BLUE, Color.RED], duration:2500, id:'tl'),
mouseEntered: {tl.play()},
mouseExited: {tl.playReverse()})
@shemnon
shemnon / BoundSpinners.groovy
Created July 24, 2009 15:56
with GROOVY-3642 applied
import groovy.swing.SwingBuilder
import groovy.beans.Bindable
@Bindable class Model {
int intField
}
sb = new SwingBuilder()
model = new Model()
Take my love, post no plan
Take me where I cannot stand
I don't care, the JDK is free
can't take the A P I from me
Make my gradients fade to black
Tell them it ain't comin' back
Burn some bridges to boil the sea
can't take the A P I from me
There's no place I can be
Since I found Java X dot Swing
@shemnon
shemnon / gist:856936
Created March 6, 2011 01:44
Add the idea plugin to every single build script
# add to ~/.gradle/initscript.gradle
addListener(new ArtifactoryGradleSettings())
class ArtifactoryGradleSettings extends BuildAdapter implements BuildListener {
def void projectsLoaded(Gradle gradle) {
Project root = gradle.getRootProject()
root.allprojects {
apply plugin: 'idea'
}
@shemnon
shemnon / gist:912639
Created April 10, 2011 19:30
Subtstance Image Wrapper Icon Deadlock
Thread-2477@12271, prio=6, in group 'main', status: 'MONITOR'
blocks Thread-2476@12270
blocks AWT-EventQueue-0@10510
waiting for Thread-2476@12270 to release lock on {1}
at org.pushingpixels.flamingo.api.common.icon.ImageWrapperIcon.setPreferredSize(ImageWrapperIcon.java:203)
at org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon.setPreferredSize(ImageWrapperResizableIcon.java:43)
at org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon.setDimension(ImageWrapperResizableIcon.java:126)
at org.pushingpixels.flamingo.api.common.icon.LayeredIcon.setDimension(LayeredIcon.java:64)
at org.pushingpixels.flamingo.internal.ui.common.BasicCommandButtonUI.syncIconDimension(BasicCommandButtonUI.java:1228)
at org.pushingpixels.flamingo.internal.ui.common.BasicCommandButtonUI$2$1.completed(BasicCommandButtonUI.java:282)
@shemnon
shemnon / PermissionVsForgiveness.java
Created February 20, 2012 20:36
Permission (guard blocks) vs. Forgiveness (catching NPEs)
import java.util.Arrays;
import java.util.Random;
import java.util.concurrent.Callable;
public class PermissionVsForgiveness {
int[] a1, a2, a3, a4;
Callable<Integer> permission = new Callable<Integer>() {
@shemnon
shemnon / gist:3621275
Created September 4, 2012 13:43
Creating a JavaFX Griffon App
griffon create-app MyJavaFXApp -archetype=javafx
@shemnon
shemnon / gist:3621291
Created September 4, 2012 13:45
Griffon Native JavaFX Packaging
griffon package jfx-native
@shemnon
shemnon / FXMLDemoInline.fxml
Created September 4, 2012 14:07
GroovyFX 3.0 FXML integration
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<AnchorPane xmlns:fx="http://javafx.com/fxml"
id="AnchorPane"
prefHeight="150.0" prefWidth="320.0" >
@shemnon
shemnon / StyleableProperty1.java
Created September 13, 2012 03:49
JavaFX CSS Styling Plumbing
public final void setBackScale(double value) {
backScaleProperty().set(value);
}
public final double getBackScale() {
return backScale == null ? 0.7 : backScale.get();
}
public final DoubleProperty backScaleProperty() {
if (backScale == null) {
backScale = new StyleableDoubleProperty(0.7) {