GroovyFX 㧠GUI ã¢ããªã±ã¼ã·ã§ã³éçºãã¯ããããï¼ï¼
ä»å¹´ããã¨ãããã¨ãªãã¾ããããä»å¹´æåã¨ãªãï¼ããã å¤å ä»å¹´æå¾ã«ãªãã§ãããï¼è¨å¿µãã¹ãã¨ã³ããªã¼ã¯ ãG* Advent Calendar 2012ãã®21æ¥ç®ã§ãã
æ¨å¹´ã¯ãã£ããåºé
ãã¦å¯ããæãããã¾ããããä»å¹´ã¯éã«åãã¾ãããï¼ï¼
ã§ãæ©éã§ãã...
çãã Gradle 使ã£ã¦ã¾ããï¼
(GroovyFX ã®è©±ã¯ã¡ãã£ã¨ããã¨ãã¦...)
èªåã¯ã¨ããã¨...
Gradle ã®æ£å¼çããªãªã¼ã¹ãããã«ãé¢ããããä»å¹´ãæ¬æ ¼çã«å°å
¥ãããã¨ãã§ãããã¡ãã£ã¨ãããããã¿ã¤ã ããã¸ã§ã¯ãã®ãã«ãããã¼ã«ã¨ãã¦å©ç¨ããç¨åº¦ã¨ããæ®å¿µãªçµæã«...
ã¨ã¯è¨ã æ³¥èãç¾å ´ã§ã¯ ã¡ãã£ã¨ãããã¼ã«ã¨ããã®ãçµæ§å¤§äºãªãã§ãããã
ã§ã ãããå¨ãã«ã使ã£ã¦ããããã¨ãã㨠ãã³ãã³ãã©ã¤ã³ ã¯ã¡ãã£ã¨...ã ã¨ããã㨠ããããã¾ãããï¼
ãã㧠GroovyFX ã§ããï¼ï¼
GroovyFX ãªã ã¨ã£ã¦ãç°¡åã« GUI ãã¼ã«ãä½ãã¡ãããã§ãã
GroovyFX ã£ã¦ä½ï¼ ã¨ãã人ã®ããã« ç°¡åã«è¨ãã¨
ãGroovy 㧠JavaFX 2.x ãç°¡åã«æ±ãããã® ã©ã¤ãã©ãª
ã§ãã(ååã®ã¾ãã¾ã§ãã...)
詳細ã¯こちら
ãã¡ãã GroovyFX ã ãã§ã OK ã§ãããGradle ã§æ´ã«å¿«é©ã«... ã®ãããªç»é¢ã表示ããã ãã§ããã°
hellofx |-- src/main/groovy/ | `-- hellofx/Main.groovy `-- build.gradleã®ãã㪠ãã£ã¬ã¯ããªæ§æã§
Main.groovy
package hellofx import static groovyx.javafx.GroovyFX.start start { stage(title: 'Hello, GroovyFX', visible: true) { scene(fill: BLACK, width: 500, height: 250) { hbox(padding: 60) { text(text: 'Groovy', font: '80pt sanserif') { fill linearGradient(endX: 0, stops: [PALEGREEN, SEAGREEN]) } text(text: 'FX', font: '80pt sanserif') { fill linearGradient(endX: 0, stops: [CYAN, DODGERBLUE]) effect dropShadow(color: DODGERBLUE, radius: 25, spread: 0.25) } } } } }
build.gradle
apply plugin: 'groovy' apply from: 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot/javafx.plugin' repositories { mavenCentral() } dependencies { groovy 'org.codehaus.groovy:groovy-all:2.0.5' groovy 'org.codehaus.groovyfx:groovyfx:0.3.1' }ã®ãããªï¼ã¤ã®ãã¡ã¤ã«ãç¨æãã¦
gradle runã¨å®è¡ããã ãã§ãï¼ï¼
ãã£ãããã ã㧠GUI ã¢ããªã±ã¼ã·ã§ã³ãä½ãããªãã¦ããæ代ã«ãªã£ããã®ã§ãã
ããã使ããªãæã¯ãªãã§ãããã
# ãã¡ãããçãã JDK 7u10 ã¯ã¤ã³ã¹ãã¼ã«ãã¦ã¾ãããï¼ï¼ JRE ã§ã¯ãã¡ã§ããã
# ããã¤ã³ã¹ãã¼ã«ãã¦ããªãã¨ããæ¹ã¯ ã¾ã㯠JDK ãã¤ã³ã¹ãã¼ã«ãã¾ãããï¼ï¼
# ãã£ãããã¨ãã¡ãã Gradle ã...
æ´ã«
gradle buildã¨å®è¡ããã° build/distributions é ä¸ã«
- JAR å½¢å¼
- JNLPå½¢å¼
- éçºç°å¢ã«ãã Windows ã®å ´å hellofx.exeãMac OS X ã®å ´å hellofx.app
ããã㯠Gradle JavaFX Plugin ã«ããå®ç¾ããã¦ãã¾ãã
æ®å¿µãªãã ä»ã®ã¨ãã å
¬å¼ãª JavaFX 2.x ç¨ã® ãã©ã°ã¤ã³ã¯ãªãããã§ããããã®ãã©ã°ã¤ã³ã¯ããªãããã§ããã
æ©ã å
¬å¼ãã©ã°ã¤ã³ã¨ãã¦æ¡ç¨ãããã¨ããã®ã§ãã...
ãã®ãã©ã°ã¤ã³ã¯
apply from: 'http://repository-javafx-gradle-plugin.forge.cloudbees.com/snapshot/javafx.plugin'ã追å ããã ãã§é©ç¨ãããJavaFX ã®ãã«ããå®è¡ã«å¿ è¦ãªè¨å®ãã¿ã¹ã¯ã追å ããã¾ãã
ãã®ãã©ã°ã¤ã³ãé©ç¨ããéã®ã¿ã¹ã¯ã¯ãããªæã...
Build tasks ----------- assemble - Assembles the outputs of this project. build - Assembles and tests this project. buildDependents - Assembles and tests this project and all projects that depend on it. buildNeeded - Assembles and tests this project and all projects it depends on. classes - Assembles the main classes. clean - Deletes the build directory. cssToBin - Converts CSS to Binary CSS. generateDebugKey - Generates the JAvaFX Debug Key. jar - Assembles a jar archive containing the main classes. jfxDeploy - Processes the JavaFX jars and generates webstart and native packages. jfxJar - Jars up the classes and adds JavaFX specific packaging. jfxSignJar - Signs the JavaFX jars the JavaFX way. packageClasses - Assembles the package classes. testClasses - Assembles the test classes. Documentation tasks ------------------- groovydoc - Generates Groovydoc API documentation for the main source code. javadoc - Generates Javadoc API documentation for the main source code. Execution tasks --------------- debug - Runs the applicaiton and sets up debugging on port 5005. run - Runs the application. Tools tasks ----------- scenicview - Adds the ScenicView agent to all Execution Tasks. Verification tasks ------------------ check - Runs all checks. test - Runs the unit tests.ã¡ãªã¿ã« ãã®ãã©ã°ã¤ã³ã§ã¯ å½åè¦ç´ã決ã¾ã£ã¦ã㦠ããã©ã«ãã§ã¯
<ããã¸ã§ã¯ãå>.Mainã ã¡ã¤ã³ã¯ã©ã¹ã«ãªãããã§ããä»åã®å ´å
hellofx.Mainã§ããã
ä»åä½æãããµã³ãã«ããã¸ã§ã¯ã㯠こちら ã§ãã
èå³ã®ããæ¹ã¯ã©ããï¼ï¼
ãã ZIP å½¢å¼ã§ãã¦ã³ãã¼ãããå ´å㯠解åå¾ã®ãã£ã¬ã¯ããªåã hellofx ã«å¤æ´ãã¦ãã ããã
æã£åãæ©ããGroovyFX ã試ãã¦ã¿ããã®ã®ãããã 㨠GroovyFX & JavaFX ã®ããããããã¥ããã®ã§ãããã¡ãã£ã¨ ããããããã®ãï¼ï¼
ã¨ãããã¨ã§ãGitHub ãããµã³ãã«ããã¸ã§ã¯ãããã¦ã³ãã¼ããã¦å®è¡ãã GUI ãã¼ã«ãä½æãã¦ã¿ã¾ããã
ãããªæã...
㧠ä»å GroovyFX ã試ãã¦ã¿ã¦ããã£ããã¨ã¯ ç°¡å㪠GUI ãã¼ã«ãä½æããç¨åº¦ã§ããã°ãGroovyFX ã® (ã¨è¨ããã Groovy ã®ããªï¼) å¼·åãªãã«ãã¼æ©è½ã使ã£ã¦å°éã«ç»é¢ãä½æããããã JavaFX 2.x ã® JavaFX Scene Builder ã使ã£ãæ¹ã楽ã£ã¦ãã¨ã§ããã
ä»ååã㦠JavaFX Scene Builder ã使ã£ã¦ã¿ãã®ã§ããããã ããªãããã§ããã
ç°¡åãªãã¼ã«ã®éçºããããªãããã㧠ååã§ã¯ãªãããª...
ãã®ãã¼ã«ã使ãã¡ãªãã㯠ãã¡ãããGUI ç»é¢ã§ ç»é¢ã®ãã¶ã¤ã³ãã§ãããã¨ãããã¨ãããã¾ããã
ãããããããããç»é¢ã®ãã¶ã¤ã³ã¨ã³ã³ããã¼ã«ãå®å
¨ã«åé¢ã§ãããã¨ãããã¨ã§ã¯ãªãã§ããããï¼
å®éã¯ãã®ãã¼ã«ã¨ãããã FXML ã使ãã¡ãªããã¨è¨ã£ãæ¹ãæ£ããã®ããããã¾ããã...
JavaFX Scene Builder ã使ãã°
- FXML ï¼JavaFX Scene Builder ã§ä½æãããXMLãã¡ã¤ã«ï¼
- CSS ï¼ãªãã¡ã¬ã³ã¹ã¯ こちらï¼
- Groovy(FX)
ããã£ã¦çµæ§ããããªãã§ããï¼ããã§ããªãæ·å± ãä¸ããã¨æããã§ãããã
㧠ä»åä½ã£ããã®ã¯ãããªæãã®æ§æã«ãªãã¾ãã
gradlefx |-- build.gradle `-- src `-- main |-- groovy | `-- gradlefx | |-- Controller.groovy | `-- Main.groovy `-- resources |-- gradlefx.css `-- gradlefx.fxml
詳ãã話ã¯ã¾ãã®æ©ä¼ã«ããã¨ãã¦...
ãã£ã ï¼(+1) ãã¡ã¤ã«ã§ GUI ãã¼ã«ãä½æã§ããã®ã§çããã ãã² ä½ãä½ã£ã¦ã¿ã¦ãã ããã
ä»åä½æãããµã³ãã«ããã¸ã§ã¯ã㯠こちら ã§ãã
èå³ã®ããæ¹ã¯ã©ããï¼ï¼
ãã ZIP å½¢å¼ã§ãã¦ã³ãã¼ãããå ´å㯠解åå¾ã®ãã£ã¬ã¯ããªåã gradlefx ã«å¤æ´ãã¦ãã ããã
G* Advent Calendar 2012 ã ããçµç¤ã«å·®ãæãã£ããã®ææã« ä»æ´ã§ã¯ããã¾ãã G* Advent Calendar 2012 ãã«ã¬ã³ãã¼å½¢å¼ã§åç
§ã§ãã GUI ã¢ããªã±ã¼ã·ã§ã³ãä½æãã¦ã¿ã¾ããã
èå³ã®ããæ¹ã¯ こちら ãã©ããï¼ï¼
ãã ZIP å½¢å¼ã§ãã¦ã³ãã¼ãããå ´å㯠解åå¾ã®ãã£ã¬ã¯ããªåã groovyfx ã«å¤æ´ãã¦ãã ããã
åæ¥ä»ã®åå è
ã®ãªã³ã¯ãã¯ãªãã¯ãã㨠ATND ã®ã³ã¡ã³ãã表示ããã¾ããã³ã¡ã³ãã®ãªã³ã¯ãæ¼ãã¨ãã©ã¦ã¶ã§ããã°ãã¿ãã¡ããã¾ãã
æéããªãã¦ããªãä¸éå端ãªããã§ãããGroovyFX ã®åå¼·ï¼WEB ãµã¼ãã¹é£æºãéåæå¦çããã©ã¦ã¶é£æº çã
ï¼ã«ã¯ããªãå½¹ã«ç«ã£ãã®ã§ ã¾ã ã¨ã·ã¨ãã¨ããããªã
ãããªãã«è¦å´ããã®ã§ãã¾ããæéãããã¨ãã« ããã°ã«ã¾ã¨ãã¦ãããã¨æãã¾ãã
ææ¥ã¯ ãããã [twitter:@kimukou_26] ããã§ããï¼ï¼
ã§ã¯ãã¿ãªãã ããã¯ãªã¹ãã¹ãï¼ï¼