易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

Axis2 java WebServices开发三POJO

环境JDK1.5
Eclipse 3.2
直接上代码:如果没有配置好环境请参看前两篇日志
服务器端代码
User类:
/*
*Class User.java
*Create Date: 2009-11-4
*Author:a276202460
*/
package com.axis.pojo.test;
public class User implements java.io.Serializable{
public boolean equals(Object obj) {
if (obj == ......

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

上一篇文章讲述了浅拷贝和深拷贝的含义,并且给出了浅拷贝的一个例子
这篇文章在那个例子的实现上作出修改,实现深拷贝,代码如下:
package com.test;
public class CloneTest
{
public static void main(String[] args)
{
Student s1 = new Student();
s1.setAge(20);
s1.setName("wudi");
School sch ......

Java Card开发常用的包(整理)

 整理了一下常用到的Java卡开发包里的方法,以后就能加快开发速度了。
//Java Card开发方法查询
import java.lang.*;
import javacard.framework.*;
import javacard.security.*;
import javacardx.crypto.*;     //该包为扩展包
//install方法
public static void install(byte[] bArray, ......

java循环遍历map

JDK1.4中
Map map = new HashMap();
Iterator it = map.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry) it.next();
Object key = entry.getKey();
Object value = entry.getValue();
}
JDK1.5中,应用新特性For-Each循环
Map m = new HashMap();
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号