SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...Toru Tamaki
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptxsn679259
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Gamesatsushi061452
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルCRI Japan, Inc.
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイスCRI Japan, Inc.
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video UnderstandingToru Tamaki
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。iPride Co., Ltd.
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsWSO2
 

Kürzlich hochgeladen (10)

Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 

JavaFX8