SlideShare a Scribd company logo
1 of 34
MAD Assignment
(High Level Display: Screen)
Submitted By:
Suman Sinkhwal
13011D4021
M.Tech(IT)
1
CONTENTS
 High-Level Display: Screens . . . . . . . . . . . . . . . . . . . . . . . 129
 Screen Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
 Alert Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Alert Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
 Form Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
 Item Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
ChoiceGroup Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
DateField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Gauge Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
StringItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
TextField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
ImageItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
 List Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Creating an Instance of a List Class . . . . . . . . . . . . . . . . . . . 184
 TextBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Creating an Instance of a TextBox Class
 Ticker Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
2
Display
The display is a crucial component of every J2ME application since
it contains objects used to present information to the person using
the application and in many cases prompts the person to enter
information that is processed by the application.
The J2ME Display class is the parent of Displayable. The
Displayable class has two subclasses of its own: Screen and
Canvas. The Screen class is used to create high-level J2ME
displays in which the methods of its subclasses handle details of
drawing objects such as radio buttons and check boxes. In contrast,
the Canvas class and its subclasses are used to create low-level
J2ME displays. The methods give you pixel-level control of the
display, enabling you to draw your own images and text such as
those used to create game
3
Screen Class
 These classes contain methods that generate radio buttons, heck boxes, lists, and other familiar
objects that users expect to find on the screen when interacting with your application..
 Display class hierarchy
public class Display
public abstract class Displayable
public abstract class Screen extends Displayable
public class Alert extends Screen
public class Form extends Screen
public class List extends Screen implements Choice
public abstract class Item
public class ChoiceGroup extends Item implements Choice
public class DateField extends Item
public class TextField extends Item
public class Gauge extends Item
public class ImageItem extends Item
public class StringItem extends Item
public class TextBox extends Screen
4
Screen Class cont..
public class Command
public class Ticker
public class Graphics
public interface Choice
public abstract class Canvas extends Displayable
public class Graphics
 The Item class has six derived classes, any number of which can be displayed within a Form
object on the screen:
■ ChoiceGroup class used to display radio buttons and check boxes
■ DateField class used for inputting a date into an application
■ TextField class used for inputting text into an application
■ Gauge class used to graphically show progress
■ ImageItem class used to display an image stored in a file
■ StringItem class used to display text on the screen
5
Alert Class
 An alert is a dialog box displayed by your program to warn a user of a potential error such as a
break in communication with a remote computer and can use for displaying any kind of message.
alert = new Alert("Failure", "Lost communication link!", null, null);
display.setCurrent(alert);
 The Alert constructor requires four parameters. The first parameter is the title of the dialog box,
which is “Failure” in this example. The next parameter is the text of the message displayed within
the dialog box. “Lost communication link!” is the text that appears when the Failure dialog box is
shown on the screen. The third parameter is the image that appears within the dialog box. The
previous example doesn’t use an image; therefore the third parameter is set to null. The last
parameter is the AlertType. The AlertType is a predefined type of alert
6
Alert Class cont..
 The value passed to the setTimeout() method determines whether an alert dialog box
is a modal dialog box or a timed dialog box. The setTimeout() method has one
parameter, which is the default timeout value
alert = new Alert("Failure", "Lost communication link!", null, null);
alert.setTimeout(Alert.FOREVER);
display.setCurrent(alert);Welding power supply is located on the
surface with connection to the diver/welder via cables
7
Alert sound
8
 Each AlertType has an associated sound that automatically plays whenever the alert
dialog box appears on the screen. The sound, which is different for each AlertType,
is used as an audio cue to indicate that an event is about to occur.
 An audio cue can be sounded without having to display the alert dialog box. You do
this by calling the playSound() method and passing it reference to the instance of the
Display class, as illustrated in the following code segment.
if (exitFlag == false)
{
AlertType.WARNING.playSound(display);
destroyApp(false);
}
Form Class
 The Form class is a container for other displayable objects that appear on the screen
simultaneously. Any derived class of the Item class can be placed within an instance of the Form
class.
 An instance is placed with the instance of the Form class by calling one of two methods.These are
insert() method and append() method.
 The following code segment illustrates how to create an instance of the Form class and call the
append() method to place an instance of the StringItem class onto the form.
private Form form;
private StringItem message;
form = new Form("My Form");
message = new StringItem("Welcome, ", "glad you could come.");
form.append(message);
 Each instance placed on a form has an index number associated with it, beginning with the value
zero.
private Form form;
private StringItem message1, message2;
private int index1;
Form = new Form("My Form");
message1 = new StringItem("Welcome, ", "glad you could come.");
message2 = new StringItem("Hello, ", "Mary.");
index1 = form.append(message1);
9
Form Class Cont..
10
An instance of the Item class that appears on the form can be replaced by
another instance of the Item class by calling the set() method. you can
remove an instance of the Item class from a form by invoking the delete()
method.
Item Class
 An Item class is a base class for a number of derived classes that can be contained within a Form
class. These derived classes are ChoiceGroup, DateField, Gauge, ImageItem, StringItem, and
TextField etc.
 used for data entry.
 The state of an instance of a class derived from the Item class changes whenever a user enters
data into the instance, such as when a check box is selected. You can capture this change by
associating an ItemStateListener with an instance of a class derived from an Item class
(ChoiceGroup, for example).
 Application manager detects the event and calls the itemStateChanged() method of the MIDlet.
 Logic within the itemStateChanged() method compares the reference to known items on the form
and then initiates processing. The nature of this processing is application dependent, but processing
is likely to retrieve the value that the user entered into the item.
private Form form;
private ChoiceGroup choiceGroup;
choiceGroup = new ChoiceGroup("Pick One", Choice.EXCLUSIVE);
form.append(choiceGroup);
form.setItemStateListener(this);
public void itemStateChanged(Item item)
{
if (item == choiceGroup)
{ // do some processing
}
}
11
Choice group Class
 Check boxes and radio buttons are often grouped into sets of
options, although there are times when one check box, rather than
multiple check boxes, is required by an application. Radio buttons
are almost always displayed in a set of radio buttons.
 Users can choose multiple check boxes within a set of check boxes,
while they can choose only one radio button within a set of radio
buttons.Area under the floor of the habitat is open to
water. Thus the welding is done in the dry but at the
hydrostatic pressure of the sea water surrounding the
Habitat
12
Creating Checkboxes
13
Creating and Accessing Radio
Buttons14
DataField Class
15
 The DateField class is used to display, edit, or input date and/or time into a MIDlet. A DateField
class is instantiated by specifying a label for the field, a field mode, and a time zone, although
time zone is optional.
DateField datefield = new DateField("Today", DateField.DATE);
DateField datefield = new DateField("Time", DateField.TIME, timeZone);
 You place a date or time into the date field by calling the setDate() method. The setDate() method
requires one parameter, which is an instance of the Date class containing the date/time value that
will appear in the date field. The getDate() method is called to retrieve the date/time value of the
date field.
Creating an Instance of Datefield
Class16
Gauge Class
17
 The Gauge class creates an animated progress bar that graphically represents the status of a
process. The indicator on the gauge generated by the Gauge class moves from one end to the
other proportionally to the completion of the process measured by the gauge.
 The Gauge class provides methods to display the gauge and move the indicator. The developer
must build the routine into the MIDlet to move the indicator. This means that the routine must
monitor the progress of the underlying process and move the indicator of the Gauge class to a
position that corresponds to the status of the process.
 You create an instance of the Gauge class by using the following code segment:
Gauge gauge = new Gauge("Like/Dislike Gauge", true, 100, 0);
 This statement creates an interactive gauge with the caption “Like/Dislike Gauge” and a scale of
zero to 100. The first parameter passed to the constructor of the Gauge class is a string
containing the caption that is displayed with the gauge. The second parameter is a boolean value
indicating whether or not the gauge is interactive. The third parameter is the maximum value of
the gauge, and the last parameter is the gauge’s initial value.
Creating an Instance of Gauge
Class18
Creating Interactive Gauge
19
StringItem Class
20
 The purpose of using a StringItem class is to display a text that cannot be modified
or deleted by the user of the MIDlet.
 AStringItem class is different from other classes derived from the Item class in that a
StringItem class does not recognize events.
 You create an instance of a StringItem class by passing the StringItem class
constructor two parameters. The first parameter is a string representing the label of
the instance. The other parameter is a string of text that will appear on the screen.
Creating the Instance of StringItem
Class
21
TextField Class
22
 The TextField class is used to capture one line or multiple lines of text entered by the user. The
number of lines of a text field depends on the maximum size of the text field when you create an
instance of the TextField class. You instantiate the TextField class by using the following
statement, passing the TextField constructor four parameters:
textfield = new TextField("First Name:", "", 30, TextField.ANY);
 The first parameter is the label that appears when the instance is displayed on the screen. The
second parameter is text that you want to appear as the default text for the instance, which the
user can edit. The third parameter is the maximum number of characters that can be held by the
instance. A word of caution: The character count that you enter is a request to the device’s
application manager and not a directive. This means the maximum number of characters that can
be entered into the text field might be lower than the value passed to the constructor.
Creating Instance of TextField
Class23
ImageItem Class
24
 There are two types of images that can be is played. These are immutable images and mutable
images. An immutable image is loaded from a file or other resource and cannot be modified once
the mage is displayed. Icons associated with MIDlets are immutable images. Amutable image is
drawn on the screen using methods available in the Graphics class. Once drawn, your MIDlet can
redraw any ortion of the image.
Creating an Instance of ImageItem
class
25
List Class
26
 The List class is used to display a list of items on the screen from
which the user can select one or multiple items. There are three
formats for the List class: radio buttons, check boxes, and an
implicit list that does not use a radio button or check box icon
 A List class differs from the ChoiceGroup class by the way events of
each instance are handled by a MIDlet.
 In contrast, a list does not generate an item state change event;
therefore, a Command needs to be added to initiate processing.
Creation of an Instance of an Implicit List
Class
27
Creating an Instance of a Checkbox- Formatted List Class
28
Creating an Instance of Radio Button- Formatted List
Class
29
TextBox Class
30
 The TextBox class is very similar to a TextField class, discussed previously
in this chapter. Both are used to receive multiple lines of textual data from a
user and constrain text that can be entered using the constraint directives
 The TextBox class and TextField class differ in that the TextBox class is
derived from the Screen class, while the TextField class is derived from the
Item class.
 Another important difference between the TextBox class and the TextField
class is that the TextBox class uses a CommandListener and cannot use an
ItemStateListener.
 An instance of the TextBox class is created by passing four parameters to
the TextBox class constructor. The first parameter is the title of the text box.
The second parameter is text used to populate the instance. The third
parameter is the maximum number of characters that can be entered into
the instance. Keep in mind that this parameter is a request and may not be
fulfilled by the device. The device determines the maximum number of
characters for an instance of the TextBox class. The last parameter is the
constraint used to limit the types of characters that can be placed within the
instance.
Creating an Instance of TextBox
Class31
Ticker Class
32
 The Ticker class is used to scroll text horizontally on the screen
much like a stock ticker scrolls stock prices across the screen.
An instance of the Ticker class can be associated with any class
derived from the Screen class and be shared among screens.
An instance of a Ticker object is created by passing the
constructor of the Ticker class a string containing the text that is
to be scrolled across the screen. You cannot control the location
on the screen where scrolling occurs. Likewise, there is no
control over the speed of the scrolling. The device that runs the
MIDlet controls both location and speed.
 You can retrieve the text associated with an instance of the
Ticker class by calling the getString() method. You can replace
the text currently scrolling across the screen by calling the
setString() method. The setString() method requires one
parameter, which is a string containing the replacement text.
Creating an Instance of Ticker
Class33
Thank You
34

More Related Content

What's hot

Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programmingsrijavel
 
android activity
android activityandroid activity
android activityDeepa Rani
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestateOsahon Gino Ediagbonya
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentAly Abdelkareem
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentproviderKrazy Koder
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivityTanmoy Barman
 
Android Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxAndroid Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxvishal choudhary
 
Android application structure
Android application structureAndroid application structure
Android application structureAlexey Ustenko
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packagesVINOTH R
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDrRajeshreeKhande
 

What's hot (20)

Applet and graphics programming
Applet and graphics programmingApplet and graphics programming
Applet and graphics programming
 
android activity
android activityandroid activity
android activity
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Java swing
Java swingJava swing
Java swing
 
Broadcast Receiver
Broadcast ReceiverBroadcast Receiver
Broadcast Receiver
 
Presentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestatePresentation on Android application life cycle and saved instancestate
Presentation on Android application life cycle and saved instancestate
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
JAVA APPLET BASICS
JAVA APPLET BASICSJAVA APPLET BASICS
JAVA APPLET BASICS
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android contentprovider
Android contentproviderAndroid contentprovider
Android contentprovider
 
SQLITE Android
SQLITE AndroidSQLITE Android
SQLITE Android
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
Android Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptxAndroid Application that makes use of RSS Feed.pptx
Android Application that makes use of RSS Feed.pptx
 
Android application structure
Android application structureAndroid application structure
Android application structure
 
java interface and packages
java interface and packagesjava interface and packages
java interface and packages
 
Applets in java
Applets in javaApplets in java
Applets in java
 
Android-dialogs in android-chapter14
Android-dialogs in android-chapter14Android-dialogs in android-chapter14
Android-dialogs in android-chapter14
 
J2ME
J2MEJ2ME
J2ME
 
Dr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWTDr. Rajeshree Khande :Introduction to Java AWT
Dr. Rajeshree Khande :Introduction to Java AWT
 

Viewers also liked

Viewers also liked (6)

Fast dse & ergonomics
Fast dse & ergonomicsFast dse & ergonomics
Fast dse & ergonomics
 
Dse myths..simplifying DSE for Business
Dse myths..simplifying DSE for BusinessDse myths..simplifying DSE for Business
Dse myths..simplifying DSE for Business
 
Understanding DSE Search by Matt Stump
Understanding DSE Search by Matt StumpUnderstanding DSE Search by Matt Stump
Understanding DSE Search by Matt Stump
 
Posturite ergonomics presentation
Posturite ergonomics presentationPosturite ergonomics presentation
Posturite ergonomics presentation
 
Workplace risk management
Workplace risk managementWorkplace risk management
Workplace risk management
 
Small computing & Mobile Computing
Small computing & Mobile ComputingSmall computing & Mobile Computing
Small computing & Mobile Computing
 

Similar to High-Level Display: Screen J2ME User Interface

SchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfSchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfDavid Harrison
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingHock Leng PUAH
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console ProgramHock Leng PUAH
 
Chapter 08
Chapter 08Chapter 08
Chapter 08llmeade
 
The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.5.3 book - Part 81 of 184The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.5.3 book - Part 81 of 184Mahmoud Samir Fayed
 
EclipseCon 2009: TmL Tutorial Exercises
EclipseCon 2009: TmL Tutorial ExercisesEclipseCon 2009: TmL Tutorial Exercises
EclipseCon 2009: TmL Tutorial ExercisesEric Cloninger
 
Maharastra EXTC NetSim Experiment Manual
Maharastra EXTC  NetSim Experiment  ManualMaharastra EXTC  NetSim Experiment  Manual
Maharastra EXTC NetSim Experiment ManualDr Praveen Jain
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024nehakumari0xf
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024kashyapneha2809
 
Graphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLetsGraphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLetsJussi Pohjolainen
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?sukeshsuresh189
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)sukeshsuresh189
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...sukeshsuresh189
 

Similar to High-Level Display: Screen J2ME User Interface (20)

Arena tutorial
Arena tutorialArena tutorial
Arena tutorial
 
Scmad Chapter04
Scmad Chapter04Scmad Chapter04
Scmad Chapter04
 
SchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdfSchemaStudioTypeLandscape_Article.pdf
SchemaStudioTypeLandscape_Article.pdf
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Getting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem SolvingGetting Started - Console Program and Problem Solving
Getting Started - Console Program and Problem Solving
 
SPF Getting Started - Console Program
SPF Getting Started - Console ProgramSPF Getting Started - Console Program
SPF Getting Started - Console Program
 
Csharp
CsharpCsharp
Csharp
 
Chapter 08
Chapter 08Chapter 08
Chapter 08
 
The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.5.3 book - Part 81 of 184The Ring programming language version 1.5.3 book - Part 81 of 184
The Ring programming language version 1.5.3 book - Part 81 of 184
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
EclipseCon 2009: TmL Tutorial Exercises
EclipseCon 2009: TmL Tutorial ExercisesEclipseCon 2009: TmL Tutorial Exercises
EclipseCon 2009: TmL Tutorial Exercises
 
Oopp Lab Work
Oopp Lab WorkOopp Lab Work
Oopp Lab Work
 
Bt j2 me
Bt j2 meBt j2 me
Bt j2 me
 
Maharastra EXTC NetSim Experiment Manual
Maharastra EXTC  NetSim Experiment  ManualMaharastra EXTC  NetSim Experiment  Manual
Maharastra EXTC NetSim Experiment Manual
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
 
Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024Java Abstract Window Toolkit (AWT) Presentation. 2024
Java Abstract Window Toolkit (AWT) Presentation. 2024
 
Graphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLetsGraphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLets
 
21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?21: Which method determines if a JRadioButton is selected?
21: Which method determines if a JRadioButton is selected?
 
Comp 328 final guide (devry)
Comp 328 final guide (devry)Comp 328 final guide (devry)
Comp 328 final guide (devry)
 
6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...6: Which of the following statements about creating arrays and initializing t...
6: Which of the following statements about creating arrays and initializing t...
 

Recently uploaded

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

High-Level Display: Screen J2ME User Interface

  • 1. MAD Assignment (High Level Display: Screen) Submitted By: Suman Sinkhwal 13011D4021 M.Tech(IT) 1
  • 2. CONTENTS  High-Level Display: Screens . . . . . . . . . . . . . . . . . . . . . . . 129  Screen Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130  Alert Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131 Alert Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138  Form Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139  Item Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 ChoiceGroup Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 DateField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Gauge Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 StringItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 TextField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170 ImageItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178  List Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 Creating an Instance of a List Class . . . . . . . . . . . . . . . . . . . 184  TextBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 Creating an Instance of a TextBox Class  Ticker Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 2
  • 3. Display The display is a crucial component of every J2ME application since it contains objects used to present information to the person using the application and in many cases prompts the person to enter information that is processed by the application. The J2ME Display class is the parent of Displayable. The Displayable class has two subclasses of its own: Screen and Canvas. The Screen class is used to create high-level J2ME displays in which the methods of its subclasses handle details of drawing objects such as radio buttons and check boxes. In contrast, the Canvas class and its subclasses are used to create low-level J2ME displays. The methods give you pixel-level control of the display, enabling you to draw your own images and text such as those used to create game 3
  • 4. Screen Class  These classes contain methods that generate radio buttons, heck boxes, lists, and other familiar objects that users expect to find on the screen when interacting with your application..  Display class hierarchy public class Display public abstract class Displayable public abstract class Screen extends Displayable public class Alert extends Screen public class Form extends Screen public class List extends Screen implements Choice public abstract class Item public class ChoiceGroup extends Item implements Choice public class DateField extends Item public class TextField extends Item public class Gauge extends Item public class ImageItem extends Item public class StringItem extends Item public class TextBox extends Screen 4
  • 5. Screen Class cont.. public class Command public class Ticker public class Graphics public interface Choice public abstract class Canvas extends Displayable public class Graphics  The Item class has six derived classes, any number of which can be displayed within a Form object on the screen: ■ ChoiceGroup class used to display radio buttons and check boxes ■ DateField class used for inputting a date into an application ■ TextField class used for inputting text into an application ■ Gauge class used to graphically show progress ■ ImageItem class used to display an image stored in a file ■ StringItem class used to display text on the screen 5
  • 6. Alert Class  An alert is a dialog box displayed by your program to warn a user of a potential error such as a break in communication with a remote computer and can use for displaying any kind of message. alert = new Alert("Failure", "Lost communication link!", null, null); display.setCurrent(alert);  The Alert constructor requires four parameters. The first parameter is the title of the dialog box, which is “Failure” in this example. The next parameter is the text of the message displayed within the dialog box. “Lost communication link!” is the text that appears when the Failure dialog box is shown on the screen. The third parameter is the image that appears within the dialog box. The previous example doesn’t use an image; therefore the third parameter is set to null. The last parameter is the AlertType. The AlertType is a predefined type of alert 6
  • 7. Alert Class cont..  The value passed to the setTimeout() method determines whether an alert dialog box is a modal dialog box or a timed dialog box. The setTimeout() method has one parameter, which is the default timeout value alert = new Alert("Failure", "Lost communication link!", null, null); alert.setTimeout(Alert.FOREVER); display.setCurrent(alert);Welding power supply is located on the surface with connection to the diver/welder via cables 7
  • 8. Alert sound 8  Each AlertType has an associated sound that automatically plays whenever the alert dialog box appears on the screen. The sound, which is different for each AlertType, is used as an audio cue to indicate that an event is about to occur.  An audio cue can be sounded without having to display the alert dialog box. You do this by calling the playSound() method and passing it reference to the instance of the Display class, as illustrated in the following code segment. if (exitFlag == false) { AlertType.WARNING.playSound(display); destroyApp(false); }
  • 9. Form Class  The Form class is a container for other displayable objects that appear on the screen simultaneously. Any derived class of the Item class can be placed within an instance of the Form class.  An instance is placed with the instance of the Form class by calling one of two methods.These are insert() method and append() method.  The following code segment illustrates how to create an instance of the Form class and call the append() method to place an instance of the StringItem class onto the form. private Form form; private StringItem message; form = new Form("My Form"); message = new StringItem("Welcome, ", "glad you could come."); form.append(message);  Each instance placed on a form has an index number associated with it, beginning with the value zero. private Form form; private StringItem message1, message2; private int index1; Form = new Form("My Form"); message1 = new StringItem("Welcome, ", "glad you could come."); message2 = new StringItem("Hello, ", "Mary."); index1 = form.append(message1); 9
  • 10. Form Class Cont.. 10 An instance of the Item class that appears on the form can be replaced by another instance of the Item class by calling the set() method. you can remove an instance of the Item class from a form by invoking the delete() method.
  • 11. Item Class  An Item class is a base class for a number of derived classes that can be contained within a Form class. These derived classes are ChoiceGroup, DateField, Gauge, ImageItem, StringItem, and TextField etc.  used for data entry.  The state of an instance of a class derived from the Item class changes whenever a user enters data into the instance, such as when a check box is selected. You can capture this change by associating an ItemStateListener with an instance of a class derived from an Item class (ChoiceGroup, for example).  Application manager detects the event and calls the itemStateChanged() method of the MIDlet.  Logic within the itemStateChanged() method compares the reference to known items on the form and then initiates processing. The nature of this processing is application dependent, but processing is likely to retrieve the value that the user entered into the item. private Form form; private ChoiceGroup choiceGroup; choiceGroup = new ChoiceGroup("Pick One", Choice.EXCLUSIVE); form.append(choiceGroup); form.setItemStateListener(this); public void itemStateChanged(Item item) { if (item == choiceGroup) { // do some processing } } 11
  • 12. Choice group Class  Check boxes and radio buttons are often grouped into sets of options, although there are times when one check box, rather than multiple check boxes, is required by an application. Radio buttons are almost always displayed in a set of radio buttons.  Users can choose multiple check boxes within a set of check boxes, while they can choose only one radio button within a set of radio buttons.Area under the floor of the habitat is open to water. Thus the welding is done in the dry but at the hydrostatic pressure of the sea water surrounding the Habitat 12
  • 14. Creating and Accessing Radio Buttons14
  • 15. DataField Class 15  The DateField class is used to display, edit, or input date and/or time into a MIDlet. A DateField class is instantiated by specifying a label for the field, a field mode, and a time zone, although time zone is optional. DateField datefield = new DateField("Today", DateField.DATE); DateField datefield = new DateField("Time", DateField.TIME, timeZone);  You place a date or time into the date field by calling the setDate() method. The setDate() method requires one parameter, which is an instance of the Date class containing the date/time value that will appear in the date field. The getDate() method is called to retrieve the date/time value of the date field.
  • 16. Creating an Instance of Datefield Class16
  • 17. Gauge Class 17  The Gauge class creates an animated progress bar that graphically represents the status of a process. The indicator on the gauge generated by the Gauge class moves from one end to the other proportionally to the completion of the process measured by the gauge.  The Gauge class provides methods to display the gauge and move the indicator. The developer must build the routine into the MIDlet to move the indicator. This means that the routine must monitor the progress of the underlying process and move the indicator of the Gauge class to a position that corresponds to the status of the process.  You create an instance of the Gauge class by using the following code segment: Gauge gauge = new Gauge("Like/Dislike Gauge", true, 100, 0);  This statement creates an interactive gauge with the caption “Like/Dislike Gauge” and a scale of zero to 100. The first parameter passed to the constructor of the Gauge class is a string containing the caption that is displayed with the gauge. The second parameter is a boolean value indicating whether or not the gauge is interactive. The third parameter is the maximum value of the gauge, and the last parameter is the gauge’s initial value.
  • 18. Creating an Instance of Gauge Class18
  • 20. StringItem Class 20  The purpose of using a StringItem class is to display a text that cannot be modified or deleted by the user of the MIDlet.  AStringItem class is different from other classes derived from the Item class in that a StringItem class does not recognize events.  You create an instance of a StringItem class by passing the StringItem class constructor two parameters. The first parameter is a string representing the label of the instance. The other parameter is a string of text that will appear on the screen.
  • 21. Creating the Instance of StringItem Class 21
  • 22. TextField Class 22  The TextField class is used to capture one line or multiple lines of text entered by the user. The number of lines of a text field depends on the maximum size of the text field when you create an instance of the TextField class. You instantiate the TextField class by using the following statement, passing the TextField constructor four parameters: textfield = new TextField("First Name:", "", 30, TextField.ANY);  The first parameter is the label that appears when the instance is displayed on the screen. The second parameter is text that you want to appear as the default text for the instance, which the user can edit. The third parameter is the maximum number of characters that can be held by the instance. A word of caution: The character count that you enter is a request to the device’s application manager and not a directive. This means the maximum number of characters that can be entered into the text field might be lower than the value passed to the constructor.
  • 23. Creating Instance of TextField Class23
  • 24. ImageItem Class 24  There are two types of images that can be is played. These are immutable images and mutable images. An immutable image is loaded from a file or other resource and cannot be modified once the mage is displayed. Icons associated with MIDlets are immutable images. Amutable image is drawn on the screen using methods available in the Graphics class. Once drawn, your MIDlet can redraw any ortion of the image.
  • 25. Creating an Instance of ImageItem class 25
  • 26. List Class 26  The List class is used to display a list of items on the screen from which the user can select one or multiple items. There are three formats for the List class: radio buttons, check boxes, and an implicit list that does not use a radio button or check box icon  A List class differs from the ChoiceGroup class by the way events of each instance are handled by a MIDlet.  In contrast, a list does not generate an item state change event; therefore, a Command needs to be added to initiate processing.
  • 27. Creation of an Instance of an Implicit List Class 27
  • 28. Creating an Instance of a Checkbox- Formatted List Class 28
  • 29. Creating an Instance of Radio Button- Formatted List Class 29
  • 30. TextBox Class 30  The TextBox class is very similar to a TextField class, discussed previously in this chapter. Both are used to receive multiple lines of textual data from a user and constrain text that can be entered using the constraint directives  The TextBox class and TextField class differ in that the TextBox class is derived from the Screen class, while the TextField class is derived from the Item class.  Another important difference between the TextBox class and the TextField class is that the TextBox class uses a CommandListener and cannot use an ItemStateListener.  An instance of the TextBox class is created by passing four parameters to the TextBox class constructor. The first parameter is the title of the text box. The second parameter is text used to populate the instance. The third parameter is the maximum number of characters that can be entered into the instance. Keep in mind that this parameter is a request and may not be fulfilled by the device. The device determines the maximum number of characters for an instance of the TextBox class. The last parameter is the constraint used to limit the types of characters that can be placed within the instance.
  • 31. Creating an Instance of TextBox Class31
  • 32. Ticker Class 32  The Ticker class is used to scroll text horizontally on the screen much like a stock ticker scrolls stock prices across the screen. An instance of the Ticker class can be associated with any class derived from the Screen class and be shared among screens. An instance of a Ticker object is created by passing the constructor of the Ticker class a string containing the text that is to be scrolled across the screen. You cannot control the location on the screen where scrolling occurs. Likewise, there is no control over the speed of the scrolling. The device that runs the MIDlet controls both location and speed.  You can retrieve the text associated with an instance of the Ticker class by calling the getString() method. You can replace the text currently scrolling across the screen by calling the setString() method. The setString() method requires one parameter, which is a string containing the replacement text.
  • 33. Creating an Instance of Ticker Class33