The Displayable class Assignment Help

Assignment Help: >> MIDlets >> The Displayable class

The Displayable class:

The approach that we will take in our tour of J2ME is to focus on one particular class - the Displayable class. This is a key class in producing visible interfaces on mobile devices. Virtually every MIDlet has a user interface and so we will concentrate on producing user interfaces, and then allow you to use your imagination and knowledge to develop interesting applications. The use of MIDlets is developing very rapidly with exciting applications being created all of the time.

A MIDlet can only display a single screen at any particular time. As we will see, the programmer can give the user the opportunity to display another screen but never more than one at a time. The physical screen is represented logically by the Display class and each MIDlet has access to only one instance of this class. Most MIDlets will get a reference to the Display object in their startApp method using the following code:

public static Display getDisplay(MIDlet mid);

The result of the method call will be assigned to a suitable variable, as any call to getDisplay will always return the same value for any given MIDlet. For example:

display = Display.getDisplay(this);

This variable can now be used within the program to avoid any further calls to 

getDisplay.

Interacting with the screen

There are two useful methods that can be used to set and get the current screen. These are setCurrent(newInterface), where newInterface is of type Displayable, and getCurrent(). Any user interface features that we want to have shown on the screen are held in a container called Displayable - this is an abstract class, which when subclassed is able to hold items such as text boxes, text fields and images, and also drawn images as in a game.

The Displayable class though is too general to cover the very different needs of data field type interactions and graphical type interactions, and so there are two subclasses of Displayable. One is called Screen and is used for high level user interfaces, and the other is called Canvas and is used for low level user interfaces. Both these classes are abstract. The subclass, Screen, has four concrete subclasses and these are the classes that are generally used. The other subclass is Canvas, and a developer can either subclass Canvas or use its subclass called GameCanvas. We will subclass Canvas in order to illustrate some of the key issues to be considered, such as the need to implement a paint method. The high level user interface classes are designed to provide components that are portable from one device to another as the detailed implementation in terms of, for example, font size, scrolling and display are taken care of by the particular device. The low level user interface class is less portable and requires the programmer to specify how the subject that is drawn on the screen is displayed and how the user is able to interact with the screen. Figure shows the class hierarchy for the Displayable class.

1864_displaying class.png

 

Figure: The Displayable class hierarchy

 

Java Assignment Help - Java Homework Help

Struggling with java programming language? Are you not finding solution for your The Displayable class homework and assignments? Live The Displayable class experts are working for students by solving their doubts & questions during their course studies and training program. We at Expertsmind.com offer The Displayable class homework help, java assignment help and The Displayable class projects help anytime from anywhere for 24x7 hours. Computer science programming assignments help making life easy for students.

Why Expertsmind for assignment help

  1. Higher degree holder and experienced experts network
  2. Punctuality and responsibility of work
  3. Quality solution with 100% plagiarism free answers
  4. Time on Delivery
  5. Privacy of information and details
  6. Excellence in solving java programming language queries in excels and word format.
  7. Best tutoring assistance 24x7 hours

 

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd