易截截图软件、单文件、免安装、纯绿色、仅160KB

JAVA ME 手机程序入门级源码

 一个由 Carol Hamer 写的比较有代表性的源码,作者全力推荐,尤其是对于没有 J2ME 开发经验的朋友。自己动手敲出以下贴出的 Hello.java 和 HelloCanvas.java 源码,并运行,用心体会一下。相信你理解了此源码之后,即可步入 J2ME 开发。
注释都在源码里,运行环境自己配,自己动手看运行效果,理解之后,然后动手修改一下源码,J2ME 开发,你可以的!
Hello.java 源码:
package net.frog_parrot.hello;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
/**
* This is the main class of the hello world demo
*
* @author Carol Hamer
*
*/
public class Hello extends MIDlet implements CommandListener {

/**
* The canvas is the region of the screen that has bean alloted to the game
*/
HelloCanvas myCanvas;

/**
* The Command objects apears as buttons.
*/
private Command exitCommand = new Command("Exit",Command.EXIT,99);

/**
* The Command objects apears as buttons.
*/
private Command newCommand = new Command("Toggle Msg",Command.SCREEN,1);

/**
* initialize the canvas and the commands
*/
public Hello() {
myCanvas = new HelloCanvas(Display.getDisplay(this));
myCanvas.addCommand(exitCommand);
myCanvas.addCommand(newCommand);
myCanvas.setCommandListener(this);
}
//--------------------------------
// implementation of MIDlet

/**
* Start the application
*/
protected void startApp() throws MIDletStateChangeException {
myCanvas.start();
}

/**
* This method is called to notify the MIDlet to enter a paused state.
* The MIDlet should use this opportunity to release shared resources.
*/
protected void pauseApp() {
}

/**
* If the MIDlet was using resources,it should release them in this method
*/
protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
}

//-----------------------
// implementation of CommandListener.
/**
* Respond to a command issued on the Canvas
* (either reset or exit)
*/
public void commandAction(Co


相关文档:

java堆栈

       1. 栈(stack)与堆(heap)都是Java用来在Ram中存放数据的地方。与C++不同,Java自动管理栈和堆,程序员不能直接地设置栈或堆。
  2. 栈的优势是,存取速度比堆要快,仅次于直接位于CPU中的寄存器。但缺点是,存在栈中的数据大小与生存期必须是确定的,缺乏灵活性。另外,栈数据可以� ......

Java的浅拷贝和深拷贝(1)

 Java的拷贝分为深拷贝和浅拷贝
浅拷贝:把一个对象中所有的非static成员变量(包括对其它对象的引用,java中的引用相当于C/C++中的指针变量)都拷贝一遍,而不拷贝引用所指向的对象
深拷贝:把一个对象中所有的非static成员变量(包括对其它对象的引用)都拷贝一遍,引用所指向的对象也拷贝一份
这篇文章先讲述浅拷贝� ......

Java Card 技术(二)

 
本系列文章的第 1 部分介绍了 Java Card 技术的高级知识 —— 什么是智能卡、Java Card 应用程序的元素、通信和不同 Java Card 技术规范的汇总。在本部分中,我们将重点介绍 Java Card applet 的开发:开发 Java Card 应用程序、Sun Java Card 开发工具箱、Java Card 和 Java Card RMI API 时所需的一般� ......

JAVA学习的一些重点


1. Java语言基础
谈到Java语言基础学习的书籍,大家肯定会推荐Bruce Eckel的《Thinking in Java》。它是一本写的相当深刻的技术书籍,Java语言基础部分基本没有其它任何一本书可以超越它。该书的作者Bruce Eckel在网络上被称为天才的投机者,作者的《Thinking in C++》在1995年曾获SoftwareDevelopment Jolt Award最佳� ......

java删除文件夹

    1. package book.io;  
   2.  
   3. import java.io.File;  
   4.  
   5. /** 
   6.  *  
   7.  * @author XWZ 
   8.  * 20 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号