Notes | procedures | Detailed installation of the development environment, the next thing to do is to write a HelloWorld a try!
Open the eclipse--->file--->new--->project---->j2me--->j2me midlet suite--->next---> Input project name---> Next---> Choose the available platforms (we choose midp2.0)--->finish
Right-click the new project in the package window--->new--->other--->j2me--->j2me midlet--->next---> Input helloworld
--->finish
The Helloworld.java file contains the basic framework of the J2ME program. All J2ME applications are derived from the MIDlet class, similar to applets and servlet. All subclasses of the inherited MIDlet class implement the 3 Methods of Startapp (), Pauseapp (), and Destroyapp (). These 3 methods correspond to the 3 states of the application: Run, stop, and perish.
When the application management software has created this MIDlet instance, it is in the stopped state. The Startapp () method is invoked, and the Destroyapp () or Pauseapp () method is called in the running state, and it enters the extinct or stopped state.
In order to be able to exit the program at any time, we also need to let the HelloWorld class implement a command listener interface Commandlistener. This interface has only one method, and the prototype is void Commandaction (Command, displayable). You can handle the command here.
You can now run it by selecting Run as emulated J2ME MIDlet in the eclipse's Run menu!
Here are a few of the classes you want to use in this applet:
Form class: Is a container class that inherits from screen. You can put any component or image into the form, such as: various text boxes, selection boxes, and so on. You can also consider it as a component manager. You can add, delete, insert, and set these components by using the form.
Command class: Defines all keystroke actions and component actions. Can be intercepted and processed by Commandlistenter.
Display class: Used to manage systems for displaying devices and input devices. Only one display is allowed for each midlet at the same time.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.