SlideShare a Scribd company logo
1 of 33
Java™Platform, Micro Edition Part 2 – High Level UI v3.0 – 01 April 2009 1 Andreas Jakl, 2009
Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Java ME courses at the University of Applied Sciences in Hagenberg, Austria at the Mobile Computing department ( http://www.fh-ooe.at/mc ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. This document contains copyright materials which are proprietary to Sun or various mobile device manufacturers, including Nokia, SonyEricsson and Motorola. Sun, Sun Microsystems, the Sun Logo and the Java™ Platform, Micro Edition are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries.  Andreas Jakl, 2009 2
GUI Elements High-Level GUI Andreas Jakl, 2009 3
Hierarchy of Displayables Andreas Jakl, 2009 Display One Display instance / MIDlet Available in all sub-classes of Displayable Command Displayable Methods for drawing to a canvas Low Level UIDraw the GUI yourself, own event handling. Used for games andbigger commercial applications. High Level UIAppearance based on default phone UI design, can not be influenced. Canvas Screen Ticker Graphics Completely pre-defined screen layouts TextBox Form List Alert Arrange predefined controls on a screen. Item Spacer CustomItem Choice (Interface) ChoiceGroup StringItem DateField ImageItem TextField Gauge 4
Hierarchy of Displayables Andreas Jakl, 2009 Display One Display instance / MIDlet Available in all sub-classes of Displayable Command Displayable Methods for drawing to a canvas Canvas Screen Ticker Graphics TextBox Form List Alert Item Spacer CustomItem Choice (Interface) ChoiceGroup StringItem DateField ImageItem TextField Gauge 5
Forms and Items How to create your own layouts Andreas Jakl, 2009 6
Form “Container” for items Displays multiple items below each other on the screen Automatic scrolling Andreas Jakl, 2009 7
Form and Items WTK emulator 2.5 (DefaultColorPhone) Nokia 7710 Emulator Andreas Jakl, 2009 Individual items, automatically arranged below each other. The appearance depends on the phone. 8
Example: ChoiceGroup Selection from multiple elements Either exclusive or multi-selection Type: EXCLUSIVE Type: MULTIPLE Type: POPUP 9 Andreas Jakl, 2009
Process Create the Form Form frmMain = new Form ("Title"); Create the ChoiceGroup ChoiceGroupitmCG = new ChoiceGroup ("Your choice:", ChoiceGroup.EXCLUSIVE);itmCG.append ("Rock", null);itmCG.append ("Paper", null); Add the ChoiceGroup to the Form frmMain.append (itmCG); If necessary: to instantly get information about item changes, register the class as ItemStateListener frmMain.setItemStateListener (this); Andreas Jakl, 2009 Usually created as member variable for easier access later on. 10
itemStateChanged() Will be called by the framework when the item selection changes: public void itemStateChanged (Item item){    if (item == itmCG)    {        if (itmCG.getSelectedIndex() == 1) { … }    }} MIDP doesn’t require that this has to be called for every single change.  Andreas Jakl, 2009 11
Item: StringItem For (modifiable) display of text Contains label (usually highlighted) and message Not editable by the user Create it explicitly: StringItemitmSI = new StringItem("StringItem",                                   "with Text");frmMain.append(itmSI); Implicit creation: // Not possible to set label frmMain.append("with Text"); … but more work when you want to change the text later on Andreas Jakl, 2009 12
Item: TextField Single- or multiline text input Optional filters to restrict the input: Andreas Jakl, 2009 13
Item: Gauge Interactive: Allow the user to modify the value (e.g. volume) Non-interactive: Progress bar (e.g. download) Infinitely running activity bar (unknown duration, e.g. when establishing a connection to a server) Andreas Jakl, 2009 14
Item: DateField To modify a Java Dateobject (date + time) Implementation of the date/time-editor highly dependent on device manufacturer e.g. date entry: graphical calendar view in Sun WTK or just plain text entry on many devices Andreas Jakl, 2009 15
Item: ImageItem Display a .png image Can also be used as button or hyperlink Various methods for positioning Code: Image im = Image.createImage("/img.png");frmMain.append(new ImageItem("ImageItem", im, ImageItem.LAYOUT_DEFAULT, null)); Graphics can also be used for ChoiceGroups, Alerts, and Lists Andreas Jakl, 2009 16
Other Items Spacer Separate two items by a specified distance Works vertically and horizontally CustomItem Base class to develop your own UI items These have to be implemented in a low-level way (you draw the item content directly using lines, …) Disadvantage: No automated adaption to the colours / layout of the system (= used by standard items) in MIDP 2.0 Andreas Jakl, 2009 17
Commands for Items Set Commands specifically for items Analogous to all objects derived from Displayable: item.addCommand(myCmd); Handling through ItemCommandListenerInterface Andreas Jakl, 2009 18
Screens Predefined standard components Andreas Jakl, 2009 19
Alert Simple dialog box Managed completely by the device, e.g. no own Commands are possible 4 visual attributes can be specified: Title Image (optional) Progress bar (optional) Text (optional) Two Alert types: Modal: Has to be dismissed by the useral.setTimeout(Alert.FOREVER); Timed: Displayed for x millisecondsal.setTimeout(1000); Andreas Jakl, 2009 20
Alert – Display Display-sequence when using an alert: Screen  Alert is being displayed  previous Screendisplay.setCurrent(al); Screen  Alertis being displayed  new Screendisplay.setCurrent(al, nextScreen); Andreas Jakl, 2009 Recap:Screen = Form, Alert, List, TextBox, Canvas 21
Alert – with Sound! Predefined sounds: Display an alert with a sound:Alert al = new Alert("Alert", "Message", null, AlertType.WARNING); Or play the sounds without displaying the Alert dialog:AlertType.INFO.playSound(display); Andreas Jakl, 2009 22
List Similar to a (full-screen) ChoiceGroupitem: select items from a list that you define Available in addition to EXCLUSIVE and MULTIPLE: IMPLICIT-Lists: selection triggers an action that can be defined by you. list = new List("Animals", List.IMPLICIT);list.append("Dogs", null);list.append("Cats", null);list.append("Snakes", null);list.setSelectCommand (cmdSelect);list.addCommand (cmdInfo);list.setCommandListener (this); Andreas Jakl, 2009 23 German for “select”
TextBox Fullscreentextinput Mostlybehaveslike a TextField-Item txtBox = new TextBox("Credit Card Number", null, 16, TextField.NUMERIC|TextField.SENSITIVE|TextField.NON_PREDICTIVE); Andreas Jakl, 2009 Default text Max. length Title Restrictions Modifiers 24
Ticker Text as ticker for instances of Displayable-objects Can not be influenced, usage usually not recommended Ticker t = new Ticker ("Vienna 30°, Barcelona 37°, Hawaii 42°");txtBox.setTicker (t);[…]// Modify the textt.setString(„Munich 17°, …");[…]// Remove the tickertxtBox.setTicker (null); Andreas Jakl, 2009 25
New UI Toolkits Now & the Future Andreas Jakl, 2009 26
eSWT Embedded Standard Widget Toolkit Cross platform toolkit Part of Eclipse eRCP (embedded Rich Client Platform) Shares most APIs with desktop SWT Features (excerpt): Rich UI Component set Flexible and scalable layout system via layout managers Rich user interface events Access to native UI functionality on par with smartphone UI frameworks Andreas Jakl, 2009 27
eSWT Integrates operating system Most “real” work done by optimized, platform-specific code (no drawing directly through Java) Traditional Java GUI library characteristics UI is constructed by widgets in containers Containers use layout managers to scale the UI Available since: S60 3rd Ed., FP2 Andreas Jakl, 2009 28
LWUIT LightWeight User Interface Toolkit Inspired by Swing But designed for constrained devices Can be added to any Java ME application (embedded .jar) Drawing done in Java source code, without native peer rendering Features (excerpt): Layouts Themes, fonts Animations & Transitions 3D / SVG integration (optional) Internationalization Andreas Jakl, 2009 29
JavaFX JavaFX(http://javafx.com – integrated in NetBeans 6.5+) New UI libraries (graphics, media, web services) Consistent experience across mobile, desktop, browser, TV, etc Plus: use any Java library in JavaFX Integrated with Java Runtime JavaFX Script Simple declarative language, easier to learn e.g., for artists to change sprite animation, without needing software developer Advantage to JavaScript / ActionScript: integration with Java – reuse any Java library Andreas Jakl, 2009 30
JavaFX Mobile Runs on Java ME (plus Android) Mobile content with same tools as Java FX Availability? JavaFX Mobile Runtime needs to be pre-installed on the phone. None released yet. Currently endorsed by: SonyEricsson, LG Andreas Jakl, 2009 31
eSWT vs. LWUIT vs. JavaFX Mobile? Architecture LWUIT & eSWT: scene graph component model framework (like Swing / SWT) JavaFX: more a vector graphics platform Features LWUIT: Simulates UI design in pure Java-code, doesn’t fit to phone UI. OK for games, not for business. eSWT: Uses native code for drawing. More flexible (browser component, etc.). Good for business and speed, not so useful for games. Support LWUIT: can be used today eSWT: only on latest Nokia phones JavaFX: Not supported yet by phones. Fully vector graphics based – will only work on newest phones Conclusion Depending on use case: Use eSWT / LWUIT now. JavaFX Mobile will be the future. http://weblogs.java.net/blog/terrencebarr/archive/2008/08/comparing_lwuit.html Andreas Jakl, 2009 32
Thanks for your attention That’s it! Andreas Jakl, 2009 33

More Related Content

Viewers also liked

11 Java User Interface Libraries for Developing Mobile Applications
11 Java User Interface Libraries for Developing Mobile Applications11 Java User Interface Libraries for Developing Mobile Applications
11 Java User Interface Libraries for Developing Mobile Applications
AEGIS-ACCESSIBLE Projects
 
J2ME GUI Programming
J2ME GUI ProgrammingJ2ME GUI Programming
J2ME GUI Programming
Rohan Chandane
 
Statistical Process Control Tools
Statistical Process Control ToolsStatistical Process Control Tools
Statistical Process Control Tools
Raja Farhan Saeed
 
AggreGate SCADA/HMI
AggreGate SCADA/HMI AggreGate SCADA/HMI
AggreGate SCADA/HMI
Tibbo
 

Viewers also liked (9)

Java ME - 01 - Overview
Java ME - 01 - OverviewJava ME - 01 - Overview
Java ME - 01 - Overview
 
Javascript Basics
Javascript BasicsJavascript Basics
Javascript Basics
 
11 Java User Interface Libraries for Developing Mobile Applications
11 Java User Interface Libraries for Developing Mobile Applications11 Java User Interface Libraries for Developing Mobile Applications
11 Java User Interface Libraries for Developing Mobile Applications
 
J2ME GUI Programming
J2ME GUI ProgrammingJ2ME GUI Programming
J2ME GUI Programming
 
Java in the Air: A Case Study for Java-based Environment Monitoring Stations
Java in the Air: A Case Study for Java-based Environment Monitoring StationsJava in the Air: A Case Study for Java-based Environment Monitoring Stations
Java in the Air: A Case Study for Java-based Environment Monitoring Stations
 
Statistical Process Control Tools
Statistical Process Control ToolsStatistical Process Control Tools
Statistical Process Control Tools
 
AggreGate SCADA/HMI
AggreGate SCADA/HMI AggreGate SCADA/HMI
AggreGate SCADA/HMI
 
8 introduction to_java_script
8 introduction to_java_script8 introduction to_java_script
8 introduction to_java_script
 
Java script
Java scriptJava script
Java script
 

Similar to Java ME - 02 - High Level UI

Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docx
Ompawar61
 
Apple TV - a quick start guide
Apple TV - a quick start guideApple TV - a quick start guide
Apple TV - a quick start guide
Ruptapas Chakraborty
 
Symbian OS - Mopoid Next Gen - Slides
Symbian OS - Mopoid Next Gen - SlidesSymbian OS - Mopoid Next Gen - Slides
Symbian OS - Mopoid Next Gen - Slides
Andreas Jakl
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
sagaroceanic11
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
sagaroceanic11
 

Similar to Java ME - 02 - High Level UI (20)

Symbian OS - Quick Start
Symbian OS - Quick StartSymbian OS - Quick Start
Symbian OS - Quick Start
 
Symbian OS - GUI Architectures
Symbian OS - GUI ArchitecturesSymbian OS - GUI Architectures
Symbian OS - GUI Architectures
 
Mobile Operating Systems
Mobile Operating SystemsMobile Operating Systems
Mobile Operating Systems
 
Symbian OS - Platform Security
Symbian OS - Platform SecuritySymbian OS - Platform Security
Symbian OS - Platform Security
 
Windows 7 mobile
Windows 7 mobileWindows 7 mobile
Windows 7 mobile
 
Symbian OS - S60
Symbian OS - S60Symbian OS - S60
Symbian OS - S60
 
Om Pawar MP AJP.docx
Om Pawar MP AJP.docxOm Pawar MP AJP.docx
Om Pawar MP AJP.docx
 
Symbian OS - Memory Management
Symbian OS - Memory ManagementSymbian OS - Memory Management
Symbian OS - Memory Management
 
Apple TV - a quick start guide
Apple TV - a quick start guideApple TV - a quick start guide
Apple TV - a quick start guide
 
Symbian OS - Mopoid Next Gen - Slides
Symbian OS - Mopoid Next Gen - SlidesSymbian OS - Mopoid Next Gen - Slides
Symbian OS - Mopoid Next Gen - Slides
 
GrafiXML, A Multi-Target User Interface Builder based on UsiXML
GrafiXML, A Multi-Target User Interface Builder based on UsiXMLGrafiXML, A Multi-Target User Interface Builder based on UsiXML
GrafiXML, A Multi-Target User Interface Builder based on UsiXML
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
Introductontoxaml
IntroductontoxamlIntroductontoxaml
Introductontoxaml
 
Going Mobile with AIR+Starling
Going Mobile with AIR+StarlingGoing Mobile with AIR+Starling
Going Mobile with AIR+Starling
 
Mac Os X Version 10
Mac Os X Version 10Mac Os X Version 10
Mac Os X Version 10
 
Android Programming Basics
Android Programming BasicsAndroid Programming Basics
Android Programming Basics
 
Advance Java Programming (CM5I) 1.AWT
Advance Java Programming (CM5I) 1.AWTAdvance Java Programming (CM5I) 1.AWT
Advance Java Programming (CM5I) 1.AWT
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
Actionscript 3 - Session 3 Action Script And Flash
Actionscript 3 - Session 3 Action Script And FlashActionscript 3 - Session 3 Action Script And Flash
Actionscript 3 - Session 3 Action Script And Flash
 

More from Andreas Jakl

More from Andreas Jakl (20)

Create Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented RealityCreate Engaging Healthcare Experiences with Augmented Reality
Create Engaging Healthcare Experiences with Augmented Reality
 
AR / VR Interaction Development with Unity
AR / VR Interaction Development with UnityAR / VR Interaction Development with Unity
AR / VR Interaction Development with Unity
 
Android Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App ManagementAndroid Development with Kotlin, Part 3 - Code and App Management
Android Development with Kotlin, Part 3 - Code and App Management
 
Android Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSONAndroid Development with Kotlin, Part 2 - Internet Services and JSON
Android Development with Kotlin, Part 2 - Internet Services and JSON
 
Android Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - IntroductionAndroid Development with Kotlin, Part 1 - Introduction
Android Development with Kotlin, Part 1 - Introduction
 
Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)Android and NFC / NDEF (with Kotlin)
Android and NFC / NDEF (with Kotlin)
 
Basics of Web Technologies
Basics of Web TechnologiesBasics of Web Technologies
Basics of Web Technologies
 
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & MoreBluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
Bluetooth Beacons - Bluetooth 5, iBeacon, Eddystone, Arduino, Windows 10 & More
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
Mobile Test Automation
Mobile Test AutomationMobile Test Automation
Mobile Test Automation
 
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
Qt App Development - Cross-Platform Development for Android, iOS, Windows Pho...
 
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows PhoneWinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
 
Nokia New Asha Platform Developer Training
Nokia New Asha Platform Developer TrainingNokia New Asha Platform Developer Training
Nokia New Asha Platform Developer Training
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
Windows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App ScenariosWindows (Phone) 8 NFC App Scenarios
Windows (Phone) 8 NFC App Scenarios
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)NFC Development with Qt - v2.2.0 (5. November 2012)
NFC Development with Qt - v2.2.0 (5. November 2012)
 
06 - Qt Communication
06 - Qt Communication06 - Qt Communication
06 - Qt Communication
 
05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics05 - Qt External Interaction and Graphics
05 - Qt External Interaction and Graphics
 
04 - Qt Data
04 - Qt Data04 - Qt Data
04 - Qt Data
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
Christopher Logan Kennedy
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Java ME - 02 - High Level UI

  • 1. Java™Platform, Micro Edition Part 2 – High Level UI v3.0 – 01 April 2009 1 Andreas Jakl, 2009
  • 2. Disclaimer These slides are provided free of charge at http://www.symbianresources.com and are used during Java ME courses at the University of Applied Sciences in Hagenberg, Austria at the Mobile Computing department ( http://www.fh-ooe.at/mc ) Respecting the copyright laws, you are allowed to use them: for your own, personal, non-commercial use in the academic environment In all other cases (e.g. for commercial training), please contact andreas.jakl@fh-hagenberg.at The correctness of the contents of these materials cannot be guaranteed. Andreas Jakl is not liable for incorrect information or damage that may arise from using the materials. This document contains copyright materials which are proprietary to Sun or various mobile device manufacturers, including Nokia, SonyEricsson and Motorola. Sun, Sun Microsystems, the Sun Logo and the Java™ Platform, Micro Edition are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. Andreas Jakl, 2009 2
  • 3. GUI Elements High-Level GUI Andreas Jakl, 2009 3
  • 4. Hierarchy of Displayables Andreas Jakl, 2009 Display One Display instance / MIDlet Available in all sub-classes of Displayable Command Displayable Methods for drawing to a canvas Low Level UIDraw the GUI yourself, own event handling. Used for games andbigger commercial applications. High Level UIAppearance based on default phone UI design, can not be influenced. Canvas Screen Ticker Graphics Completely pre-defined screen layouts TextBox Form List Alert Arrange predefined controls on a screen. Item Spacer CustomItem Choice (Interface) ChoiceGroup StringItem DateField ImageItem TextField Gauge 4
  • 5. Hierarchy of Displayables Andreas Jakl, 2009 Display One Display instance / MIDlet Available in all sub-classes of Displayable Command Displayable Methods for drawing to a canvas Canvas Screen Ticker Graphics TextBox Form List Alert Item Spacer CustomItem Choice (Interface) ChoiceGroup StringItem DateField ImageItem TextField Gauge 5
  • 6. Forms and Items How to create your own layouts Andreas Jakl, 2009 6
  • 7. Form “Container” for items Displays multiple items below each other on the screen Automatic scrolling Andreas Jakl, 2009 7
  • 8. Form and Items WTK emulator 2.5 (DefaultColorPhone) Nokia 7710 Emulator Andreas Jakl, 2009 Individual items, automatically arranged below each other. The appearance depends on the phone. 8
  • 9. Example: ChoiceGroup Selection from multiple elements Either exclusive or multi-selection Type: EXCLUSIVE Type: MULTIPLE Type: POPUP 9 Andreas Jakl, 2009
  • 10. Process Create the Form Form frmMain = new Form ("Title"); Create the ChoiceGroup ChoiceGroupitmCG = new ChoiceGroup ("Your choice:", ChoiceGroup.EXCLUSIVE);itmCG.append ("Rock", null);itmCG.append ("Paper", null); Add the ChoiceGroup to the Form frmMain.append (itmCG); If necessary: to instantly get information about item changes, register the class as ItemStateListener frmMain.setItemStateListener (this); Andreas Jakl, 2009 Usually created as member variable for easier access later on. 10
  • 11. itemStateChanged() Will be called by the framework when the item selection changes: public void itemStateChanged (Item item){ if (item == itmCG) { if (itmCG.getSelectedIndex() == 1) { … } }} MIDP doesn’t require that this has to be called for every single change. Andreas Jakl, 2009 11
  • 12. Item: StringItem For (modifiable) display of text Contains label (usually highlighted) and message Not editable by the user Create it explicitly: StringItemitmSI = new StringItem("StringItem", "with Text");frmMain.append(itmSI); Implicit creation: // Not possible to set label frmMain.append("with Text"); … but more work when you want to change the text later on Andreas Jakl, 2009 12
  • 13. Item: TextField Single- or multiline text input Optional filters to restrict the input: Andreas Jakl, 2009 13
  • 14. Item: Gauge Interactive: Allow the user to modify the value (e.g. volume) Non-interactive: Progress bar (e.g. download) Infinitely running activity bar (unknown duration, e.g. when establishing a connection to a server) Andreas Jakl, 2009 14
  • 15. Item: DateField To modify a Java Dateobject (date + time) Implementation of the date/time-editor highly dependent on device manufacturer e.g. date entry: graphical calendar view in Sun WTK or just plain text entry on many devices Andreas Jakl, 2009 15
  • 16. Item: ImageItem Display a .png image Can also be used as button or hyperlink Various methods for positioning Code: Image im = Image.createImage("/img.png");frmMain.append(new ImageItem("ImageItem", im, ImageItem.LAYOUT_DEFAULT, null)); Graphics can also be used for ChoiceGroups, Alerts, and Lists Andreas Jakl, 2009 16
  • 17. Other Items Spacer Separate two items by a specified distance Works vertically and horizontally CustomItem Base class to develop your own UI items These have to be implemented in a low-level way (you draw the item content directly using lines, …) Disadvantage: No automated adaption to the colours / layout of the system (= used by standard items) in MIDP 2.0 Andreas Jakl, 2009 17
  • 18. Commands for Items Set Commands specifically for items Analogous to all objects derived from Displayable: item.addCommand(myCmd); Handling through ItemCommandListenerInterface Andreas Jakl, 2009 18
  • 19. Screens Predefined standard components Andreas Jakl, 2009 19
  • 20. Alert Simple dialog box Managed completely by the device, e.g. no own Commands are possible 4 visual attributes can be specified: Title Image (optional) Progress bar (optional) Text (optional) Two Alert types: Modal: Has to be dismissed by the useral.setTimeout(Alert.FOREVER); Timed: Displayed for x millisecondsal.setTimeout(1000); Andreas Jakl, 2009 20
  • 21. Alert – Display Display-sequence when using an alert: Screen  Alert is being displayed  previous Screendisplay.setCurrent(al); Screen  Alertis being displayed  new Screendisplay.setCurrent(al, nextScreen); Andreas Jakl, 2009 Recap:Screen = Form, Alert, List, TextBox, Canvas 21
  • 22. Alert – with Sound! Predefined sounds: Display an alert with a sound:Alert al = new Alert("Alert", "Message", null, AlertType.WARNING); Or play the sounds without displaying the Alert dialog:AlertType.INFO.playSound(display); Andreas Jakl, 2009 22
  • 23. List Similar to a (full-screen) ChoiceGroupitem: select items from a list that you define Available in addition to EXCLUSIVE and MULTIPLE: IMPLICIT-Lists: selection triggers an action that can be defined by you. list = new List("Animals", List.IMPLICIT);list.append("Dogs", null);list.append("Cats", null);list.append("Snakes", null);list.setSelectCommand (cmdSelect);list.addCommand (cmdInfo);list.setCommandListener (this); Andreas Jakl, 2009 23 German for “select”
  • 24. TextBox Fullscreentextinput Mostlybehaveslike a TextField-Item txtBox = new TextBox("Credit Card Number", null, 16, TextField.NUMERIC|TextField.SENSITIVE|TextField.NON_PREDICTIVE); Andreas Jakl, 2009 Default text Max. length Title Restrictions Modifiers 24
  • 25. Ticker Text as ticker for instances of Displayable-objects Can not be influenced, usage usually not recommended Ticker t = new Ticker ("Vienna 30°, Barcelona 37°, Hawaii 42°");txtBox.setTicker (t);[…]// Modify the textt.setString(„Munich 17°, …");[…]// Remove the tickertxtBox.setTicker (null); Andreas Jakl, 2009 25
  • 26. New UI Toolkits Now & the Future Andreas Jakl, 2009 26
  • 27. eSWT Embedded Standard Widget Toolkit Cross platform toolkit Part of Eclipse eRCP (embedded Rich Client Platform) Shares most APIs with desktop SWT Features (excerpt): Rich UI Component set Flexible and scalable layout system via layout managers Rich user interface events Access to native UI functionality on par with smartphone UI frameworks Andreas Jakl, 2009 27
  • 28. eSWT Integrates operating system Most “real” work done by optimized, platform-specific code (no drawing directly through Java) Traditional Java GUI library characteristics UI is constructed by widgets in containers Containers use layout managers to scale the UI Available since: S60 3rd Ed., FP2 Andreas Jakl, 2009 28
  • 29. LWUIT LightWeight User Interface Toolkit Inspired by Swing But designed for constrained devices Can be added to any Java ME application (embedded .jar) Drawing done in Java source code, without native peer rendering Features (excerpt): Layouts Themes, fonts Animations & Transitions 3D / SVG integration (optional) Internationalization Andreas Jakl, 2009 29
  • 30. JavaFX JavaFX(http://javafx.com – integrated in NetBeans 6.5+) New UI libraries (graphics, media, web services) Consistent experience across mobile, desktop, browser, TV, etc Plus: use any Java library in JavaFX Integrated with Java Runtime JavaFX Script Simple declarative language, easier to learn e.g., for artists to change sprite animation, without needing software developer Advantage to JavaScript / ActionScript: integration with Java – reuse any Java library Andreas Jakl, 2009 30
  • 31. JavaFX Mobile Runs on Java ME (plus Android) Mobile content with same tools as Java FX Availability? JavaFX Mobile Runtime needs to be pre-installed on the phone. None released yet. Currently endorsed by: SonyEricsson, LG Andreas Jakl, 2009 31
  • 32. eSWT vs. LWUIT vs. JavaFX Mobile? Architecture LWUIT & eSWT: scene graph component model framework (like Swing / SWT) JavaFX: more a vector graphics platform Features LWUIT: Simulates UI design in pure Java-code, doesn’t fit to phone UI. OK for games, not for business. eSWT: Uses native code for drawing. More flexible (browser component, etc.). Good for business and speed, not so useful for games. Support LWUIT: can be used today eSWT: only on latest Nokia phones JavaFX: Not supported yet by phones. Fully vector graphics based – will only work on newest phones Conclusion Depending on use case: Use eSWT / LWUIT now. JavaFX Mobile will be the future. http://weblogs.java.net/blog/terrencebarr/archive/2008/08/comparing_lwuit.html Andreas Jakl, 2009 32
  • 33. Thanks for your attention That’s it! Andreas Jakl, 2009 33