lightweight ui toolkit - making …...lightweight ui toolkit for the java me platform- making...

24
LIGHTWEIGHT UI TOOLKIT - MAKING COMPELLING JAVA™ ME APPLICATIONS EASY Chen Fishbein, Software Architect Shai Almog, Software Architect Yoav Barel, Senior Manager TS-4921

Upload: others

Post on 27-Jun-2020

26 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

LIGHTWEIGHT UI TOOLKIT - MAKING COMPELLING JAVA™ ME APPLICATIONS EASY

Chen Fishbein, Software Architect Shai Almog, Software ArchitectYoav Barel, Senior Manager

TS-4921

Page 2: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 2

Agenda

What is LWUIT?Why?Key BenefitsKey FeaturesDemoSamplesToolsAdvanced ConceptsGet StartedQ&A

Page 3: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 3

What Is LWUIT?

Lightweight library bundled with the applicationCompelling UIConsistent across different devicesToday's handsets MIDP 2.0/CLDC 1.1 only requirement!Inspired by SwingResource editor

Page 4: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 4

Developed in-house to support project Hydrazine Complex UI requirements on existing devicesHigh portabilityDeveloper's feedbackBridges the gap between today and tomorrow

Why?

Page 5: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 5

Key Benefits

Rapid development• Familiar API• Clean & Simple

Easy deployment• One JAR – many devices

Mass market devicesConsistentExtendableFilthy Rich UIBrand-able

Page 6: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 6

Swing Like MVCLayoutsPLAF & ThemesFontsTouch ScreenAnimations & TransitionsRich widgets3D Integration

PaintersModal DialogSynchronous ModelExternal ToolsI18N/L10N

Key Features

Page 7: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 7

Approach

Page 8: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 8

LWUIT Demo

Page 9: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 9

LWUIT Demo

Page 10: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 10

Samples – Hello World

Form frm = new Form(“Hi”);frm.addComponent(new Label(“World”));frm.addCommand(exitCommand);frm.show();

Now Make It Beautiful...

Resources r = Resources.open(“/myTheme.res"); UIManager.getInstance().setThemeProps(r.getTheme(“theme”);

Page 11: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 11

Samples – List

Form frm = new Form(“List”);frm.setLayout(new BorderLayout());List lst = new List(new String[] { “Item 1”, “Item 2”, “Item 3”, “Item 4”});lst.setListCellRenderer(new MyRenderer());frm.addComponent(BorderLayout.CENTER, lst);frm.addCommand(exitCommand);frm.show();

Page 12: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 12

Samples – Rendererclass MyRenderer extends Label implements ListCellRenderer { private Image sady, smily; ... public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) { setText(value.toString()); setFocus(isSelected); if (isSelected) { setIcon(sady); getStyle().setBgTransparency(100); } else { setIcon(smily); getStyle().setBgTransparency(0); } return this; } public Component getListFocusComponent(List list) { return getListCellRendererComponent(list,"",0,true); }}

Page 13: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 13

Samples – Renderer (cont)

Page 14: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 14

Samples – FormForm frm = new Form(“Survey”);frm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));frm.addComponent(new Label(“Are you happy?”));final RadioButton yes = new RadioButton(“Yes”);RadioButton no = new RadioButton(“No”);frm.addComponent(yes);frm.addComponent(no);ButtonGroup bg = new ButtonGroup();bg.add(yes); bg.add(no);Button submit = new Button(“Submit”);frm.addComponent(submit);submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String text = “Too bad :-(“; if(yes.isSelected()) { text = “Yay!!!”; } Dialog.show(“Result”, text, “OK”, null); }});frm.show();

Page 15: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 15

Resource Editor

Optional ToolBuilt For DesignersStandaloneResources:• Themes• Fonts• Animations/Images• Localization• Arbitrary Data

LWUITDemo “live preview”

Page 16: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 16

Matisse GUI Builder

Award Winning, Mature Group Layout – Baseline alignmentRelative spacing/growEvent Handling CodeD&D/C&PStyles & ThemesComponent PaletteCustom Components

Page 17: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 17

Tools Demo

Page 18: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 18

Advanced Concepts

Uses native rendering engineRenders onto GameCanvasOptional M3G rendering integrationPlanned: SVG supportAbstracts physical motionAnimations/Transitions based on internal engineThreading approach of Swing coupled with builtin FoxtrotSingle EDT for rendering and events

Page 19: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 19

Performance & Portability

Testing heavily on Sprint devices, Nokia, SE, Motorolla and phoneMEMany additional phones are testedDesigned for small size/overheadMost overhead is in resourcesIndexedImage & light mode for low endDoesn't require preprocessor

Page 20: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 20

Footprint

Jar size as low as 50kb for a small applicationMemory depends on theme/functionality/resolutionUI Demo runs on 320x240x24bpp Nokia S40 using under 1mb and no more than 2mbThemes can be light or heavy depending on their features

Page 21: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 21

FAQs ...

MIDP 2.0 devices support LCDUI, why do I need LWUIT?• LWUIT offers a rich UI alternative that sits on top of MIDP• Both complement each other and LWUIT remains strictly optional

Will I need to learn a new API?How similar is it to Swing?• LWUIT was inspired by Swing. Developers should find it easy to move

between LWUIT and AGUI/Swing APIs

How will LWUIT assist me in dealing with fragmentation?• LWUIT is Implemented on top of Canvas therefore highly portable• Not a device API but bundled together with the application

There are other UI toolkits out there – why LWUIT?• We believe LWUIT offers very attractive functionality for developing

consistent and compelling Java ME apps• LWUIT remains strictly optional• Due to the open source nature of LWUIT we hope cross-pollination

will occur for the benefit of the entire industry

Page 22: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 22

Get Started

Early access on java.net (binary) http://lwuit.dev.java.netOnline TutorialAvailable in Sprint WTK 3.3Come visit us at: The Mobility Village podPlease send us feedbackOpen Source soon!!!

Page 23: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 23

Q&A

Page 24: LIGHTWEIGHT UI TOOLKIT - MAKING …...Lightweight UI Toolkit For The Java ME Platform- Making Compelling Java ME UI's Easy, TS-4921, JavaOne 2008 Conference, San Francisco, Chen Fishbein,

2008 JavaOneSM Conference | java.sun.com/javaone | 24

Chen Fishbein, Software Architect Shai Almog, Software ArchitectYoav Barel, Senior Manager

TS-4921