Skip to content

Instantly share code, notes, and snippets.

@hideaki-t
Created July 3, 2011 01:04
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hideaki-t/1061852 to your computer and use it in GitHub Desktop.
Save hideaki-t/1061852 to your computer and use it in GitHub Desktop.
a custom browser using GroovyFX.
import groovyx.javafx.ClosureEventHandler
import groovyx.javafx.GroovyFX
import groovyx.javafx.SceneGraphBuilder
import javafx.animation.Interpolator
import javafx.animation.TranslateTransition
import javafx.util.Duration
GroovyFX.start({
def loadAction = { view.engine.load(new URI(urlBox.getText()).toString()) }
def stage = new SceneGraphBuilder().stage(title: "GroovyFXのテスト") {
scene(width: 800, height: 600) {
vbox(spacing: 10, layoutY: 10) {
hbox(spacing: 10, alignment: "center") {
urlBox = textBox(columns: 40, action: loadAction);
button(text: "Load", onAction: loadAction)
}
view = webView(
engine: webEngine(location: "http://www.yahoo.co.jp/"),
prefWidth: 800, prefHeight: 400,
translateX: 800,
effect: reflection(),
)
}
}
}
view.engine.loadTask.onDone = new ClosureEventHandler(action: {
new TranslateTransition().with {
node = view
fromX = 800
toX = 0
interpolator = Interpolator.EASE_BOTH
duration = new Duration(500)
play()
}
})
view.engine.loadTask.onStarted = new ClosureEventHandler(action: {
new TranslateTransition().with {
node = view
fromX = 0
toX = -800
duration = new Duration(500)
play()
}
})
stage.visible = true
});
@bgoetzmann
Copy link

Very interesting! Thank you.

@hideaki-t
Copy link
Author

Hi, thank you for Interesting this. I updated this for JavaFX 2.0 build 36+ and newer GroovyFX.
https://gist.github.com/1101054

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment