一个经典的 JAVA ME 手机程序入门级源码
一个经典的 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
* (
相关文档:
//调用存储过程带参
CallableStatement ca = conn.prepareCall("{call Login (?,?)}");
ca.setString(1,username);
& ......
这里对于几个基本的概念 URL TCP UDP Socket 就不加说明了,这里仅仅是记录一些学习日志备忘。
1:如何定义相对资源
假设有如下两个资源 :
http://www.gamelan.com/pages/Gamelan.game.html
http://www.gamelan.com/pa ......
第5章图形界面设计(一)
(一)课程内容
5.1 图形界面设计基础
5.1.1 AWI’和Swing
5.1.2组件和容器
5.1.3事件驱动程序设计基础
5.2框架窗口 .
5.3标签、按钮和按钮事件
5.3.1 标签
5.3.2按钮和按钮事件处理
5.4面板
5.4.1 JPanel
5.4.2 JScrollPane
5.5布局设计
5.5.1 FlowI.ayout布局
5.5.2 BorderI.a ......
/*
本段代码在公司项目中实际远程调用第三方公司提供的C#开发WebService的示例
*/
/**
* 登录游戏
*
* @param paramPN
* @param paramTerraceID
* @param paramSvrID
*/
private String loginGame(String paramPN, HttpServletRequest req){
&n ......