Created
July 3, 2011 01:04
-
-
Save hideaki-t/1061852 to your computer and use it in GitHub Desktop.
a custom browser using GroovyFX.
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
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 | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, thank you for Interesting this. I updated this for JavaFX 2.0 build 36+ and newer GroovyFX.
https://gist.github.com/1101054