很早以前弄过一点JAVA,现在弄J2ME算是摸着石头过河吧。
J2ME这一部分实现手机上看书的功能,最终应该做成jar的形式后,在手机上发布且运行,要求可以翻页,可以设置书签,可以设置字体。
// joymobook v1.0 by freemobile
// www.joymo.cn;www.iiwap.net
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class JoymoBookFrm extends MIDlet
implements CommandListener
{
private Display dsp;
private Form frm;
private Command cmdView;
private Command cmdExit;
private Image img;
public JoymoBookFrm()
{
}
public final void startApp()
throws MIDletStateChangeException
{
dsp = Display.getDisplay(this);
cmdView = new Command("看书", 4, 1);
cmdExit = new Command("退出", 7, 2);
frm = new Form("角摩网-joymo.cn"); // www.joymo.cn
try
{
img = Image.createImage("/Java.png");
}
catch(IOException _ex) { }
ImageItem imageitem = new ImageItem("\n", img, 3, "Image Cannot be shown");
frm.append(imageitem);
StringItem si = new StringItem(null, "[书名]测试\n" + "[作者]freemobile\n[制作]\n[说明]本软件的设计者为freemobile,QQ:19149653.\n互联网访问:joymo.cn\nWAP访问:iiwap.net");
frm.append(si);
frm.addCommand(cmdView);
frm.addCommand(cmdExit);
frm.setCommandListener(this);
dsp.setCurrent(frm);
}
public final void pauseApp()
{
}
public final void destroyApp(boolean flag)
throws MIDletStateChangeException
{
}
public final void commandAction(Command command, Displayable displayable)
{
if(command == cmdExit)
{
notifyDestroyed();
return;
}
// begin to view the book
// if(command == cmdView)
// 转入看书流程,用专门的类实现--www.iiwap.net
}
}
实现的界面如下,屏幕中的软件的LOGO为java.png图片,呵呵这样的界面看上去要专业一些。
![](https://www.cnblogs.com/images/cnblogs_com/freemobile/j2me5.JPG)
J2ME这一部分实现手机上看书的功能,最终应该做成jar的形式后,在手机上发布且运行,要求可以翻页,可以设置书签,可以设置字体。
// joymobook v1.0 by freemobile
// www.joymo.cn;www.iiwap.net
import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
public class JoymoBookFrm extends MIDlet
implements CommandListener
{
private Display dsp;
private Form frm;
private Command cmdView;
private Command cmdExit;
private Image img;
public JoymoBookFrm()
{
}
public final void startApp()
throws MIDletStateChangeException
{
dsp = Display.getDisplay(this);
cmdView = new Command("看书", 4, 1);
cmdExit = new Command("退出", 7, 2);
frm = new Form("角摩网-joymo.cn"); // www.joymo.cn
try
{
img = Image.createImage("/Java.png");
}
catch(IOException _ex) { }
ImageItem imageitem = new ImageItem("\n", img, 3, "Image Cannot be shown");
frm.append(imageitem);
StringItem si = new StringItem(null, "[书名]测试\n" + "[作者]freemobile\n[制作]\n[说明]本软件的设计者为freemobile,QQ:19149653.\n互联网访问:joymo.cn\nWAP访问:iiwap.net");
frm.append(si);
frm.addCommand(cmdExit);
frm.setCommandListener(this);
dsp.setCurrent(frm);
}
public final void pauseApp()
{
}
public final void destroyApp(boolean flag)
throws MIDletStateChangeException
{
}
public final void commandAction(Command command, Displayable displayable)
{
if(command == cmdExit)
{
notifyDestroyed();
return;
}
// begin to view the book
// if(command == cmdView)
// 转入看书流程,用专门的类实现--www.iiwap.net
}
}
实现的界面如下,屏幕中的软件的LOGO为java.png图片,呵呵这样的界面看上去要专业一些。