Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Writing a Custom Counter Component

MIDP 2.0 introduced the javax.microedition.lcdui.CustomItem class. As the name implies, a developer can now create custom UI components by extending the CustomItem class. This tech tip designs and implements a UI component for displaying a numeric counter

Tutorial Details:

On occasion you may want your MIDP application to display a counter, for example to display the number of seconds elapsed since some operation started. It's fairly simple to write a custom component that automatically updates and displays such a counter. With a bit of careful coding you can even make it work with canvases, custom application-drawn screens derived from the Canvas class, and on forms, using the MIDP 2.0 CustomItem class.

The key to making a dual-purpose component is to separate the drawing of the component from its management. The reason is that there is no concept of a component when working with a canvas as a whole; the application itself must draw and manage the entire canvas. A custom item, on the other hand, is a true component; the system delegates drawing to the component but handles most of the management itself. To handle this difference, you define a callback interface that your component uses to delegate management tasks to the appropriate code.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Writing a Custom Counter Component

View Tutorial:
Writing a Custom Counter Component

Related Tutorials:

Java Q&A - Java Still Open
Java Q&A - Java Still Open
 
Focus on Swing - JavaWorld - July 1998
Focus on Swing - JavaWorld - July 1998
 
Write high-performance RMI servers and Swing clients - JavaWorld - April 1999
Write high-performance RMI servers and Swing clients - JavaWorld - April 1999
 
How to drag and drop with Java 2, Part 2 - JavaWorld August 1999
How to drag and drop with Java 2, Part 2 - JavaWorld August 1999
 
An open alternative to JSP - The faults of JSP So what's wrong with JSP?
How the template-based, open source API FreeMarker trumps JSP
 
A first look at JavaServer Faces, Part I
A first look at JavaServer Faces, Part Learn how to implement Web-based user interfaces with JSF
 
A first look at JavaServer Faces, Part 2
A first look at JavaServer Faces, Part 2
 
Datastructures and algorithms, Part 1
Datastructures and algorithms, Part 1
 
JavaServer Faces, redux
JavaServer Faces, redux
 
FindBugs, Part 2: Writing custom detectors
FindBugs, Part 2: Writing custom detectors How to write custom detectors to find application-specific problems In the first article in this series, I showed you how to set up and execute FindBugs. Now we'll take a look at FindBugs' most powerful fea
 
Creating JSF Custom Components
Creating JSF Custom Components This article illustrates how to build custom components for use in web applications based on JavaServer Faces (JSF). While JSF comes with a standard set of components, one of the most-publicized features is the easy additio
 
Creating Custom Desktop Components
This article presents a drawing component used by an image-annotation application named JImaging. Some of the JImaging code has already been described in two other articles, titled "Prototyping Desktop Applications" and "Data Models for Desktop Apps."
 
Java Calendar Component
Java date picker component, ready to use in your Swing applications featuring.
 
Annotations in Tiger, Part 2: Custom annotations
Write your own annotations in Java 5 Part 1 of this series introduced annotations, the new metadata facility in J2SE 5.0, and focused on Tiger's basic built-in annotations. A more powerful related feature is support for writing your own annotations. In t
 
Java Resources
There are all Java freebies. Some of these are old, and not under maintenance. Download and use them at your risk. In case of queries, mail subrahmanyam_avb@technologist.com or varalakshmi_a@techie.com.
 
JavaServer Faces Technology
JavaServer Faces technology is a server-side user interface component framework for Java technology-based Web applications.
 
Compare JavaServer Pages: Tag Libraries vs. JavaBeans
Java provides developers with JavaServer Pages (JSPs) and Servlets as a superior alternative to traditional CGI programs. The architecture of JSPs provide support for a logical and physical separation between the HTML page designers and the component deve
 
Writing a Custom Counter Component
MIDP 2.0 introduced the javax.microedition.lcdui.CustomItem class. As the name implies, a developer can now create custom UI components by extending the CustomItem class. This tech tip designs and implements a UI component for displaying a numeric counter
 
Introduction To Enterprise Java Bean(EJB). WebLogic 6.0 Tutorial.
Introduction To Enterprise Java Bean(EJB). WebLogic 6.0 Tutorial. Welcome to EJB Section (Learn to Develop World Class Applications with Enterprise Java Beans) (Online WebLogic 6.0 Tutorial) Introduction To Enterprise Java Bean(EJB) Enterprise
 
Introduction To Enterprise Java Bean(EJB). Developing web component.
Introduction To Enterprise Java Bean(EJB). Developing web component. Developing web component Introduction To Java Beans J2EE specification defines the structure of a J2EE application. According to the specification J2EE application consists of
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.