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

📄 login.java

📁 J2ME程序:手动设置URL主机地址和端口
💻 JAVA
字号:


import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.TextField;

public class Login implements Runnable{
	
	public gameStart  start;		
   	public String UserName = ""	;		
   	public String UserPassword = "";	
	Thread t;

	
	public Login(gameStart g){
		start = g;
		t=new Thread(this);
	}
	
	
	
	public void run() {	
		int inputStr=0;
			try{		
                start.connection1.address="socket://192.168.1.120:"+start.port3;				
				System.out.println("this is init net GAME_LOGIN");
			    start.connection1.SendUserInfo("96",start.UserName2,start.UserPassword2);
	    	    try{
				inputStr = Integer.parseInt(start.connection1.getOneData().substring(0,2));
	    	    }catch(Exception e){System.out.println("thsi is is is 11"+e);}
//				注册,1为成功,2为不成功
	    	    if(inputStr == 3){  
	    	    		
	    	    	   start.display.setCurrent(new Alert("system message:","log in sucessfully!",null,AlertType.ERROR));
	    	    	   start.MainThread.start();
	    	    	   start.Clear();
	    	    	   start.display.setCurrent(start.messageInputForm);
	    	   
	    	    }else if(inputStr == 4){
	    	    	start.connection1.CleanOutNet();
	    	    	start.display.setCurrent(new Alert("system message:", "incorrect ID or password!", null, AlertType.ERROR));
	    	    	return;
	    	    }else{
	    	    	start.display.setCurrent(new Alert("system message:", "connetion error!", null, AlertType.ERROR));
	    	    }
	    	 }catch(Exception e){
	    		 start.display.setCurrent(new Alert("system message:", "internet error!", null, AlertType.ERROR));
	    	 System.out.println("this is net Error!!!!!!!!!!!");
	    	 }
		
	     }

		
		
		
		}
		
	

⌨️ 快捷键说明

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