J2ME中文教程 7 开发无线网络应用程序[42]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

import javax.microedition.lcdui.CommandListener;

import javax.microedition.lcdui.Display;

import javax.microedition.lcdui.Displayable;

import javax.microedition.lcdui.Form;

import javax.microedition.lcdui.StringItem;

import javax.microedition.lcdui.TextField;

public class Server implements Runnable, CommandListener

{

    private DatagramMIDlet parent;

    private Display display;

    private Form f;

    private StringItem si;

    private TextField tf;

    private Command sendCommand = new Command("Send", Command.ITEM, 1);

    Sender sender;

    private String address;

    public Server(DatagramMIDlet m)

    {

        parent = m;

        display = Display.getDisplay(parent);

        f = new Form("Datagram Server");

        si = new StringItem("Status:", " ");

        tf = new TextField("Send:", "", 30, TextField.ANY);

        f.append(si);

        f.append(tf);

        f.addCommand(sendCommand);

        f.setCommandListener(this);

        display.setCurrent(f);

    }

本文关键:J2ME中文教程 7 开发无线网络应用程序
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top