supercharging your javafx programs with widgetfx and jfxtras · 2009. 8. 5. · movie widget...

27
Supercharging Your JavaFX Programs with WidgetFX and JFXtras Stephen Chin Inovis, Inc. Keith Combs Inovis, Inc.

Upload: others

Post on 15-Sep-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Supercharging Your JavaFX Programs with WidgetFX and JFXtras

Stephen ChinInovis, Inc.

Keith CombsInovis, Inc.

Page 2: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

The JavaFX Desktop Widget Platform

WidgetFX

Page 3: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

WidgetFX Origins

3

Page 4: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

4

Why another desktop widget framework?

> Open-Source

But widgets can be licensed commercially

> Write Widgets in Java & JavaFX

HTML, CSS, and Javascript are great for websites, but not app development

> Cross-Platform Support

Windows XP/Vista, Linux, and Mac OS X.

> One-Click Installation

Plus automatic updates of the dock and widgets.

> Robust Security

Secure sandbox + signed widgets

Page 5: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Built-in Widgets

> Clock

Skinnable via CSS

> Slide Show

Configurable Directory, Speed, & Filter

> Web Feed

Supports Atom and all RSS flavors

5

Page 6: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Dock Features

> Drag to desktop

> Resize widgets (option for fixed aspect ratio)

> Per widget transparency

> Widget settings saved on restart

> Toggle dock always-on-top

> Launch on start-up

> Multi-monitor support

> Dock and widgets can be styled via CSS

6

Page 7: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Movie Widget Tutorial

Page 8: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Properties

Name Type Inherited From Description

width Number Resizable Initial width of the widget.

height Number Resizable Initial height of the widget.

aspectRatio Number Widget If set, defines a fixed aspect

ratio for the widget width and

height.

content Node[] Group Visible children of the widget.

Contains a sequence of

Nodes.

8

Page 9: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Definition

var widget: Widget;

widget = Widget {

width: 640

height: 352

aspectRatio: bind player.media.width

/ player.media.height

content: bind player

}

9

Page 10: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Load the Media

var source = "http://projavafx.com/movies/elephants-dream-640x352.flv";

var player = bind SimpleMoviePlayer {

media: Media {

source: source

}

width: bind widget.width

height: bind widget.height

}

10

Page 11: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Run in Widget Runner

11

Page 12: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Configuration PropertiesClass Name Type Description

BooleanProperty Boolean This class allows you to persist sequences of

Booleans

BooleanSequenceProperty Boolean[] This class allows you to persist sequences of

Booleans

IntegerProperty Integer This class allows you to persist Integers

IntegerSequenceProperty Integer[] This class allows you to persist sequences of Integers

LongProperty Long This class allows you to persist Longs

LongSequenceProperty Long[] This class allows you to persist sequences of Longs

NumberProperty Number This class allows you to persist Numbers

NumberSequenceProperty Number[] This class allows you to persist sequences of

Numbers

StringProperty String This class allows you to persist Strings

StringSequenceProperty String[] This class allows you to persist sequences of Strings

12

Page 13: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Configuration

widget = Widget {...configuration: Configuration {properties: [StringProperty {name: "source“value: bind source with inverse

}]scene: Scene {…} // see next page

}}

13

Page 14: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Config Dialog

Scene {content: Grid {

rows: row([Text {

content: "Source URL:“},TextBox {

columns: 30,value: bind source with inverse

}])

}}

14

Page 15: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Add an On-Replace Trigger

var player = bind SimpleMoviePlayer {

media: Media {

source: source

}

width: bind widget.width

height: bind widget.height

} on replace =oldPlayer {

oldPlayer.player.stop();

}

15

Page 16: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Configuration (demo)

16

Page 18: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

The Pac-Man Challenge!

> “I Wish... Henry Zhang would make a WidgetFX widget from his JavaFXPac-Man game”

-- Jim Weaver

18

javafxpert.com

Page 19: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

The Pac-Man Challenge!

> With about one week to go, I think it is interesting and fun to give it a try.

After adjusting the width and height, it was just simply working! (see the image on the [right])

-- Henry Zhang

19

javafxgame.com

Page 20: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

20

So What is With the Bunny?

Page 21: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Meet Nabaztag

> Wifi-Enabled Rabbit

> 4 Multi-Colored LEDs

> Rotating Ears

> Text to Speech Conversion

> Audio Sensor for Command Input

> REST API for Interactions

21

Page 22: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Nabaztag Widget

> Widget Functionality:

Send Messages Using Text-to-Speech

Move the Ears

Send a Choreography

Play an Audio Stream

22

Page 23: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Nabaztag API

> REST call for sending messages:

http://api.nabaztag.com/vl/FR/api.jsp?sn=0013D3862711&token=1242371191&tts=Hello+SD+Forum

> REST call for repositioning ears:

http://api.nabaztag.com/vl/FR/api.jsp?sn=0013D3862711&token=1242371191&posleft=4&posright=5

23

Page 25: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Widget Development Contest

> Sign up at http://widgetfx.org/

25

Page 26: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

Contest Details

> How to Enter:

1. Download the WidgetFX 1.2 SDK

2. Develop a desktop widget that runs in WidgetFX

3. Submit your widget to the Widget Library

> Prizes:

1. 12 free e-books, one a month for a year

2. 3 free e-books

3. 1 free e-book

> Deadline:

August 31st

26

Page 27: Supercharging Your JavaFX Programs with WidgetFX and JFXtras · 2009. 8. 5. · Movie Widget Tutorial. Widget Properties ... aspectRatio Number Widget If set, defines a fixed aspect

27

Stephen Chinhttp://steveonjava.com/

Tweet: steveonjava

Keith Combs

Thank You