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

📄 connectiondialog.java

📁 symbian下ffmpeg编程。。废了好大劲下下来的!。
💻 JAVA
字号:
/* * Movino J2ME Client * Copyright (C) 2007  Johannes Berg *  * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. *  * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. *  * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. */package org.movino.connection;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;import javax.microedition.lcdui.Ticker;import org.movino.Options;import org.movino.Returnable;import org.movino.Showable;public class ConnectionDialog extends Returnable implements CommandListener, ConnectionListener{	private Form propertyForm;	private TextField userNameField;	private TextField passwordField;		private Command abortCommand;	private Command okCommand;		private MovinoConnection movinoConnection;		public ConnectionDialog(MovinoConnection connection){		movinoConnection = connection;		movinoConnection.setListener(this);	}	public void show(Display display){		propertyForm = new Form("New session");		propertyForm.setTicker(new Ticker("Connecting..."));		abortCommand = new Command("Cancel", Command.CANCEL, 1);		propertyForm.addCommand(abortCommand);		propertyForm.setCommandListener(this);				userNameField = new TextField("User name",Options.optionUserName,20,TextField.ANY);		propertyForm.append(userNameField);				passwordField = new TextField("Password","",20,TextField.PASSWORD);		propertyForm.append(passwordField);				okCommand = new Command("Ok", Command.OK,1);				ConnectionThread.currentThread.newConnection(movinoConnection);		display.setCurrent(propertyForm);	}		public void reShow(Display display){		display.setCurrent(propertyForm);	}		public void commandAction(Command cmd, Displayable disp) {		if(cmd==abortCommand){			movinoConnection.abort();			returnBack();		}		else if(cmd==okCommand){			if(movinoConnection.getState()==MovinoConnection.CONNECTION_STATE_HANDSHAKING){				HandShakePacket hsp = movinoConnection.getServerHandShake();				String name = null;				String password = null;				if(hsp.getUserName()!=null){					name = userNameField.getString();					Options.optionUserName = name;				}				if(hsp.getPassword()!=null) password = passwordField.getString();				HandShakePacket cp = new HandShakePacket(name,password);				cp.setRandomData(hsp.getRandomData());				movinoConnection.setClientHandShake(cp);			}			MovinoConnection.currentConnection=movinoConnection;			returnBack();		}	}		public void connectionError(MovinoConnection conn, int error_state){		propertyForm.setTicker(null);		if(error_state!=MovinoConnection.CONNECTION_STATE_CONNECTED){			alert("Could not connect to server. "+conn.getError());		}		else{			alert("Connection to server lost. "+conn.getError());		}	}	public void connectionSuccess(MovinoConnection conn) {		HandShakePacket hsp = movinoConnection.getServerHandShake();		if(hsp.getUserName()==null){			propertyForm.delete(0);			if(hsp.getPassword()==null) propertyForm.delete(0);		}		else{			if(hsp.getPassword()==null) propertyForm.delete(1);		}				if(propertyForm.size()<=0){			commandAction(okCommand, propertyForm);		}		else{			propertyForm.addCommand(okCommand);			propertyForm.setTicker(null);		}	}}

⌨️ 快捷键说明

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