⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 httpexample.java

📁 j2me实例代码
💻 JAVA
字号:
package ConnectionImpl;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.io.*;
import java.io.*;
import javax.microedition.io.*;
import java.util.*;
import javax.microedition.lcdui.*;
public class HttpExample extends MIDlet implements CommandListener{

	private Command exit,start;
	private Display display;
	private Form form;
	private StringItem stars;
	
	public HttpExample() {
		super();
		display=Display.getDisplay(this);
		exit=new Command("Exit",Command.EXIT,1);
		start=new Command("start",Command.EXIT,1);
		form=new Form("Customer Ranking");
		form.addCommand(exit);
		form.addCommand(start);
		form.setCommandListener(this);
		String str=System.getProperty("microedition.commports");
		System.out.println(str);
	}

	protected void startApp() throws MIDletStateChangeException {
		display.setCurrent(form);

	}

	protected void pauseApp() {
		// TODO Auto-generated method stub

	}

	protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
		// TODO Auto-generated method stub

	}

	public void commandAction(Command c, Displayable d) {
		/*if(c==start){
			System.out.println("ccccccccccccc");
			StreamConnection connection=null;
			InputStream in=null;
			StringBuffer buffer=new StringBuffer();
			try{
				connection=(StreamConnection)Connector.open("http://www.baidu.com");
				in=connection.openInputStream();
				int ch;
				System.out.println("aaaaaaaaaaaaaa");
				while((ch=in.read())!=-1){
					System.out.println("this is"+ch);
				}
				System.out.println("dddddddddddddd");
			}catch(IOException e){
				System.out.println(buffer.toString());
				
			}
		}
		*/
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -