SlideShare a Scribd company logo
1 of 29
Download to read offline
JavaFX 8
自己紹介
•hakurai
•Backlog開発チーム@ヌーラボ
•関ジャバ
•hoge駆動
•奈良模型愛好会
JavaFX 8での新機能
• RichText
• Printing for JavaFX
• 3D API
• (Lambda)
What is JavaFX
• Swingに換わる新しいGUI フレームワーク
• XML(FXML)による画面定義
• CSSによるスタイリング
• アニメーション/エフェクト
• データバインディング
RichText
• TextFlow
• 書式付きテキスト用のレイアウト
• 子ノードのTextなどをレイアウトする
TextFlow サンプル
String family = "Helvetica";
double size = 20;
TextFlow textFlow = new TextFlow();
Text text1 = new Text("Hello ");
text1.setFont(Font.font(family, size));
Text text2 = new Text("Bold");
text2.setFont(Font.font(family, FontWeight.BOLD, size));
Text text3 = new Text(" ITALIC");
text3.setFont(Font.font(family, FontPosture.ITALIC, size));
textFlow.getChildren().addAll(text1, text2, text3);
TextFlow サンプル
String family = "Helvetica";
double size = 64;
TextFlow textFlow = new TextFlow();
Text text1 = new Text("Hello ");
text1.setFont(Font.font(family, size));
Text text2 = new Text("Bold");
text2.setFont(Font.font(family, FontWeight.BOLD, size));
Text text3 = new Text(" ITALIC");
text3.setFont(Font.font(family, FontPosture.ITALIC, size));
textFlow.getChildren().addAll(text1, text2, text3);
太字
イタリック
Textにスタイルを追加
text1.setStyle("-fx-stroke: rgb(255, 0, 0);-fx-fill: rgba(255, 0, 0, 0.2);");
text2.setStyle("-fx-fill: green;-fx-effect: dropshadow(gaussian, gray, 8, 0.5, 8,
8);");
text3.setStyle("-fx-underline: true;-fx-fill: transparent;-fx-stroke: linear-
gradient(from 0% 0% to 100% 100%, repeat, black 0%, blue 50%);-fx-
stroke-width: 1;");
• Printer
• PrinterJob
Printing for JavaFX
• Shape3d
• Box(直方体)
• Cylinder(円柱)
• Sphere(球体)
• MeshView(メッシュ)
• TriangleMesh
3D API
• SubScene
• DrawMode
• Material(材質)
• LightBase(光源)
• PointLight(点光源)
• AmbientLight(環境光)
3D API
Box / Cylinder / Sphere サンプル
Box box = new Box(100, 100, 100);
Cylinder cylinder = new Cylinder(50, 100, 30);
Sphere sphere = new Sphere(50);
Box / Cylinder / Sphere サンプル
Material サンプル
Box box = new Box(100, 100, 100);
box.setMaterial(new PhongMaterial(Color.RED));
Cylinder cylinder = new Cylinder(50, 100, 30);
cylinder.setMaterial(new PhongMaterial(Color.YELLOW));
Sphere sphere = new Sphere(50);
sphere.setMaterial(new PhongMaterial(Color.GREEN));
Material サンプル
MeshView / TriangleMesh サンプル
• 三次元オブジェクトの形状を三角メッシュで描画
MeshView / TriangleMesh
• 三角メッシュ
• Points(頂点)
• Faces(面)
• TextCoords(UVテクスチャ座標)
• FaceSmoothingGroups
MeshView / TriangleMesh
• 実はこれも三角メッシュ
MeshView / TriangleMesh
• 実はこれも三角メッシュ
Loader Support (OpenJDKWiki)
• Many 3D file formats exist, such as:
• Obj, Maya, 3D Studio Max, Collada, KRML
• We will not provide a loader as part of the JavaFX runtime
• We will make sample code available for one or two popular format
apps/experiments/ 3DViewer
• 読み込み *.ma *.ase *.obj *.dae
• 書き出し *.fxml
Lambda
• イベントリスナ
• Bindings
イベントリスナ
topicMessageService.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent workerStateEvent) {
Posts newPosts = (Posts) workerStateEvent.getSource().getValue();
appendPosts(newPosts);
}
});
イベントリスナ
topicMessageService.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent workerStateEvent) {
Posts newPosts = (Posts) workerStateEvent.getSource().getValue();
appendPosts(newPosts);
}
});
イベントリスナ
topicMessageService.setOnSucceeded(workerStateEvent -> {
Posts newPosts = (Posts) workerStateEvent.getSource().getValue();
appendPosts(newPosts);
});
Bindings
unreadPostsCount.bind(createLongBinding( () -> {
messageList.stream().filter( m -> m.getId() > maxUnreadId.get() ).count()
},maxUnreadId, messageList));
JavaFX8

More Related Content

More from Kazuhiro Eguchi

なれる!クラスローダー
なれる!クラスローダーなれる!クラスローダー
なれる!クラスローダーKazuhiro Eguchi
 
Java 並行処理の基礎update1
Java 並行処理の基礎update1Java 並行処理の基礎update1
Java 並行処理の基礎update1Kazuhiro Eguchi
 
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~Kazuhiro Eguchi
 
Automate the Swing application testing
Automate the Swing application testingAutomate the Swing application testing
Automate the Swing application testingKazuhiro Eguchi
 

More from Kazuhiro Eguchi (8)

Haxe
HaxeHaxe
Haxe
 
実践Knockout
実践Knockout実践Knockout
実践Knockout
 
なれる!クラスローダー
なれる!クラスローダーなれる!クラスローダー
なれる!クラスローダー
 
Knockout
KnockoutKnockout
Knockout
 
Java 並行処理の基礎update1
Java 並行処理の基礎update1Java 並行処理の基礎update1
Java 並行処理の基礎update1
 
Starting java fx
Starting java fxStarting java fx
Starting java fx
 
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
並行処理プログラミングの深淵~Java仮想マシン仕様 スレッドとロック~
 
Automate the Swing application testing
Automate the Swing application testingAutomate the Swing application testing
Automate the Swing application testing
 

Recently uploaded

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものですiPride Co., Ltd.
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...Toru Tamaki
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNetToru Tamaki
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Yuma Ohgami
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdftaisei2219
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)Hiroki Ichikura
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A surveyToru Tamaki
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 

Recently uploaded (10)

SOPを理解する 2024/04/19 の勉強会で発表されたものです
SOPを理解する       2024/04/19 の勉強会で発表されたものですSOPを理解する       2024/04/19 の勉強会で発表されたものです
SOPを理解する 2024/04/19 の勉強会で発表されたものです
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
論文紹介:Content-Aware Token Sharing for Efficient Semantic Segmentation With Vis...
 
論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet論文紹介:Automated Classification of Model Errors on ImageNet
論文紹介:Automated Classification of Model Errors on ImageNet
 
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
Open Source UN-Conference 2024 Kawagoe - 独自OS「DaisyOS GB」の紹介
 
TSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdfTSAL operation mechanism and circuit diagram.pdf
TSAL operation mechanism and circuit diagram.pdf
 
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
【早稲田AI研究会 講義資料】3DスキャンとTextTo3Dのツールを知ろう!(Vol.1)
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey論文紹介:Semantic segmentation using Vision Transformers: A survey
論文紹介:Semantic segmentation using Vision Transformers: A survey
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 

JavaFX8