JavaFX8

  • 913 views
Uploaded on

 

More in: Technology , Design
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
913
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
4
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. JavaFX 8
  • 2. 自己紹介•hakurai•Backlog開発チーム@ヌーラボ•関ジャバ•hoge駆動•奈良模型愛好会
  • 3. JavaFX 8での新機能• RichText• Printing for JavaFX• 3D API• (Lambda)
  • 4. What is JavaFX• Swingに換わる新しいGUI フレームワーク• XML(FXML)による画面定義• CSSによるスタイリング• アニメーション/エフェクト• データバインディング
  • 5. RichText• TextFlow• 書式付きテキスト用のレイアウト• 子ノードのTextなどをレイアウトする
  • 6. 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);
  • 7. 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);太字イタリック
  • 8. 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;");
  • 9. • Printer• PrinterJobPrinting for JavaFX
  • 10. • Shape3d• Box(直方体)• Cylinder(円柱)• Sphere(球体)• MeshView(メッシュ)• TriangleMesh3D API
  • 11. • SubScene• DrawMode• Material(材質)• LightBase(光源)• PointLight(点光源)• AmbientLight(環境光)3D API
  • 12. Box / Cylinder / Sphere サンプルBox box = new Box(100, 100, 100);Cylinder cylinder = new Cylinder(50, 100, 30);Sphere sphere = new Sphere(50);
  • 13. Box / Cylinder / Sphere サンプル
  • 14. 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));
  • 15. Material サンプル
  • 16. MeshView / TriangleMesh サンプル• 三次元オブジェクトの形状を三角メッシュで描画
  • 17. MeshView / TriangleMesh• 三角メッシュ• Points(頂点)• Faces(面)• TextCoords(UVテクスチャ座標)• FaceSmoothingGroups
  • 18. MeshView / TriangleMesh• 実はこれも三角メッシュ
  • 19. MeshView / TriangleMesh• 実はこれも三角メッシュ
  • 20. 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
  • 21. apps/experiments/ 3DViewer• 読み込み *.ma *.ase *.obj *.dae• 書き出し *.fxml
  • 22. Lambda• イベントリスナ• Bindings
  • 23. イベントリスナtopicMessageService.setOnSucceeded(new EventHandler<WorkerStateEvent>() {@Overridepublic void handle(WorkerStateEvent workerStateEvent) {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);}});
  • 24. イベントリスナtopicMessageService.setOnSucceeded(new EventHandler<WorkerStateEvent>() {@Overridepublic void handle(WorkerStateEvent workerStateEvent) {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);}});
  • 25. イベントリスナtopicMessageService.setOnSucceeded(workerStateEvent -> {Posts newPosts = (Posts) workerStateEvent.getSource().getValue();appendPosts(newPosts);});
  • 26. BindingsunreadPostsCount.bind(createLongBinding( () -> {messageList.stream().filter( m -> m.getId() > maxUnreadId.get() ).count()},maxUnreadId, messageList));