JavaFX8
Upcoming SlideShare
Loading in...5
×
 

JavaFX8

on

  • 1,132 views

 

Statistics

Views

Total Views
1,132
Views on SlideShare
1,131
Embed Views
1

Actions

Likes
1
Downloads
4
Comments
0

1 Embed 1

https://twitter.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

JavaFX8 JavaFX8 Presentation Transcript

  • 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• PrinterJobPrinting for JavaFX
  • • Shape3d• Box(直方体)• Cylinder(円柱)• Sphere(球体)• MeshView(メッシュ)• TriangleMesh3D 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>() {@Overridepublic void handle(WorkerStateEvent workerStateEvent) {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);}});
  • イベントリスナtopicMessageService.setOnSucceeded(new EventHandler<WorkerStateEvent>() {@Overridepublic void handle(WorkerStateEvent workerStateEvent) {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);}});
  • イベントリスナtopicMessageService.setOnSucceeded(workerStateEvent -> {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);});
  • BindingsunreadPostsCount.bind(createLongBinding( () -> {messageList.stream().filter( m -> m.getId() > maxUnreadId.get() ).count()},maxUnreadId, messageList));