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

📄 displaymain.java

📁 手机控制邮件以及附件的发送
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
				}			}		});	}	public void file_more_screen() {		display.vibrate(500);		file_more_screen =new Message("Any file else want to transfer? ",1,this);		display.setCurrent(file_more_screen);		file_more_screen.addCommand(yesCommand);		file_more_screen.addCommand(noCommand);		file_more_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==yesCommand) {					file_list_screen.select_pressed=false;					file_list_screen.thread= new Thread(file_list_screen);					file_list_screen.thread.start();					file_list_screen.choice =0;					file_list_screen.display_choice=0;					file_list_screen.progress_h = file_list_screen.screenHeight/8+1;					display.setCurrent(file_list_screen);					update_filelist(1);				}				if (c==noCommand) {					transfer_screen("","","");					currentpath="";				}			}		});	}	private void email_fail_screen() {		display.vibrate(500);		email_fail_screen =new Message("The email address is not valid. Please re-enter. ",0,this);		display.setCurrent(email_fail_screen);		email_fail_screen.addCommand(backCommand);		email_fail_screen.addCommand(exitCommand);		email_fail_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c==backCommand) {					transfer_screen.choice =0;					transfer_screen.draw_choice(0);					display.setCurrent(transfer_screen);					transfer_screen.select_pressed = false;					transfer_screen.thread= new Thread(transfer_screen);					transfer_screen.thread.start();				}			}		});	}	private void send_sucess_screen() {		display.vibrate(500);		send_sucess_screen =new Message("File sending sucess. ",2,this);		display.setCurrent(send_sucess_screen);		send_sucess_screen.addCommand(okCommand);		send_sucess_screen.addCommand(exitCommand);		send_sucess_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c==okCommand) {					function_screen();					for (int i =0; i <file_selected.length; i++){						file_selected[i] =null;					}				}			}		});	}	private void send_fail_screen() {		display.vibrate(500);		send_fail_screen =new Message("File sending faliture. Please contact the administartor. ",0,this);		display.setCurrent(send_fail_screen);		send_fail_screen.addCommand(backCommand);		send_fail_screen.addCommand(exitCommand);		send_fail_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c==backCommand) {					transfer_screen.choice=0;					transfer_screen.draw_choice(0);					display.setCurrent(transfer_screen);					transfer_screen.select_pressed = false;					transfer_screen.thread= new Thread(transfer_screen);					transfer_screen.thread.start();				}			}		});	}	private void login_fail_screen() {		display.vibrate(500);		login_fail_screen =new Message("The login name or password is incorrect. Please re-enter. ",0,this);		display.setCurrent(login_fail_screen);		login_fail_screen.addCommand(backCommand);		login_fail_screen.addCommand(exitCommand);		login_fail_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c==backCommand) {					login_screen.choice=0;					login_screen.draw_choice(0);					display.setCurrent(login_screen);					login_screen.select_pressed = false;					login_screen.thread= new Thread(login_screen);					login_screen.thread.start();				}			}		});	}	private void connect_fail_screen() {		display.vibrate(500);		connection_fail_screen =new Message("Remote computer cannot be connected. Please try again later.  ",0,this);		display.setCurrent(connection_fail_screen);		connection_fail_screen.addCommand(backCommand);		connection_fail_screen.addCommand(exitCommand);		connection_fail_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c==backCommand) {					currentpath="";					login_screen.choice=0;					login_screen.draw_choice(0);					display.setCurrent(login_screen);					login_screen.select_pressed = false;					login_screen.thread= new Thread(login_screen);					login_screen.thread.start();				}			}		});	}	private void login_screen(String i, String l, String p) {		int t=0;		login_screen = new Select(display, i, l, p, t, this);		display.setCurrent(login_screen);		login_screen.addCommand(okCommand);		login_screen.addCommand(exitCommand);		login_screen.setCommandListener (new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c== okCommand) {					login_screen.select_pressed =true;					int count =ip.indexOf(":");					if (count==-1) {						ip=ip+":8080";					}					generateService(ip);					CurrentUser = ln;					verify_login();				}				if (c== exitCommand) {					destroyApp(false);					notifyDestroyed();				}			}		});	}	public void transfer_screen(String e, String t, String c) {		int a=1;		int count = 0;		transfer_screen = new Select(display, e, t, c, a, this);		transfer_screen.selected_file="";		for (int i =0; i <file_selected.length; i++){			if (file_selected[i] !=null) {				count += 1;				transfer_screen.selected_file =transfer_screen.selected_file +  file_selected[i].substring(file_selected[i].lastIndexOf('\\')+1,file_selected[i].length());				transfer_screen.selected_file =transfer_screen.selected_file+ ", ";			}		}		file_toSend = new String[count];		for (int i=0; i < count; i++)			file_toSend[i]=file_selected[i];		transfer_screen.selected_file = transfer_screen.selected_file.substring(0,transfer_screen.selected_file.length()-2);		transfer_screen.draw_choice(0);		display.setCurrent(transfer_screen);		transfer_screen.addCommand(okCommand);		transfer_screen.addCommand(backCommand);		transfer_screen.setCommandListener (new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c== okCommand) {					transfer_screen.select_pressed =true;					if (verify_email()){						verify_send();					}else {						email_fail_screen();					}				}				if (c== backCommand) {					for (int i =0; i <file_selected.length; i++){						file_selected[i] =null;					}					transfer_screen.select_pressed =true;					function_screen();				}			}		});	}	public void setting_screen(String s, String i) {		int t=2;		setting_screen = new Select(display, s,i,"",t,this);		display.setCurrent(setting_screen);		setting_screen.addCommand(exitCommand);		setting_screen.addCommand(backCommand);		setting_screen.setCommandListener (new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==exitCommand) {					destroyApp(false);					notifyDestroyed();				}				if (c== backCommand) {					setting_screen.select_pressed =true;					function_screen();				}			}		});	}	private void set_default_ip_screen() {		display.vibrate(500);		set_default_ip_screen =new Message("Do you want to set the new IP address as default? ",1,this);		display.setCurrent(set_default_ip_screen);		set_default_ip_screen.addCommand(yesCommand);		set_default_ip_screen.addCommand(noCommand);		set_default_ip_screen.setCommandListener(new CommandListener() {			public void commandAction (Command c, Displayable d) {				if (c==yesCommand) {					default_ip=ip;					//save the default ip					data_ip=default_ip.getBytes();					try{						rs.setRecord(1,data_ip,0,default_ip.length());					}catch (Exception e){						System.out.println(e);					}				}				if (c==noCommand) {				}				login_screen.draw_choice(0);				display.setCurrent(login_screen);				login_screen.select_pressed = false;				login_screen.thread= new Thread(login_screen);				login_screen.thread.start();			}		});	}	public void textbox(String i, String l, String p, final int choice, final int type) {		if (choice ==0) {			if (type==0) {				tb = new TextBox ("IP",i,20,TextField.ANY);			}			if (type==1) {				tb = new TextBox ("Email",i,300,TextField.ANY);			}		}		if (choice ==1) {			if (type==0) {				tb = new TextBox ("Login name",l,25,TextField.ANY);			}			if (type==1) {				tb = new TextBox ("Title",l,60,TextField.ANY);			}			if (type==2) {				tb = new TextBox ("Default IP",l,20,TextField.ANY);			}		}		if (choice ==2) {			if (type==0) {				tb = new TextBox ("Password",p,25,TextField.PASSWORD);			}			if (type==1) {				tb = new TextBox ("Content",p,450,TextField.ANY);			}		}		tb.addCommand(okCommand);		tb.addCommand(backCommand);		tb.setCommandListener (new CommandListener() {			public void commandAction (Command c, Displayable d) {					if (type==0) {						if (c== okCommand) {							if(choice==0) {								ip = tb.getString();								login_screen.set_first_field(ip);							}							if (choice==1) {								ln = tb.getString();								login_screen.set_second_field(ln);							}							if(choice==2) {								pw =tb.getString();								login_screen.set_third_field(pw);							}							if (choice ==0 && !ip.equals(default_ip)) {								set_default_ip_screen();							}else{								login_screen.draw_choice(choice);								display.setCurrent(login_screen);								login_screen.select_pressed = false;								login_screen.thread= new Thread(login_screen);								login_screen.thread.start();							}						}						if (c== backCommand) {							login_screen.draw_choice(choice);							display.setCurrent(login_screen);							login_screen.select_pressed = false;							login_screen.thread= new Thread(login_screen);							login_screen.thread.start();						}					}					if (type==1) {						if (c== okCommand) {							if (choice==0) {								email = tb.getString();								transfer_screen.set_first_field(email);							}							if (choice==1) {								title = tb.getString();								transfer_screen.set_second_field(title);							}							if (choice==2) {								content=tb.getString();								transfer_screen.set_third_field(content);							}							transfer_screen.draw_choice(choice);							display.setCurrent(transfer_screen);						}						if (c== backCommand) {							transfer_screen.draw_choice(choice);							display.setCurrent(transfer_screen);						}						transfer_screen.select_pressed = false;						transfer_screen.thread= new Thread(transfer_screen);						transfer_screen.thread.start();					}				if (type==2) {					if (c== okCommand) {						if (choice==1) {							default_ip = tb.getString();							data_ip=default_ip.getBytes();							try{								rs.setRecord(1,data_ip,0,default_ip.length());							}catch (Exception e){								System.out.println(e);							}							setting_screen.set_second_field(default_ip);						}						setting_screen.draw_choice(choice);						display.setCurrent(setting_screen);					}					if (c== backCommand) {						setting_screen.draw_choice(choice);						display.setCurrent(setting_screen);					}					setting_screen.select_pressed = false;					setting_screen.thread= new Thread(setting_screen);					setting_screen.thread.start();				}			}		});		display.setCurrent(tb);	}}

⌨️ 快捷键说明

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