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

📄 message.java

📁 手机控制邮件以及附件的发送
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package remote.display;// standardimport java.io.ByteArrayInputStream;import java.util.Hashtable;import java.util.Stack;//micro editionimport javax.microedition.lcdui.*;import javax.microedition.lcdui.game.*;import javax.microedition.midlet.*;import javax.microedition.io.*;import java.io.*;import javax.microedition.media.*;import javax.microedition.media.control.*;class Message extends GameCanvas implements Runnable{	private Graphics g;	String content;	int type;	int screenWidth;	int screenHeight;	public Thread thread;	public boolean select_pressed;	Font font;	Font font_title;	int temp2;	String display_text[]={"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};	int a=0;	int progress_h;	int l=0;	InputStream success;	Player p;	public Image preview;	public String currentpath;	public String file_type;	public String date;	public String size;	public boolean hidden;	DisplayMain main;	protected Message(String c, int t,DisplayMain m) {		super(true);		content=c;		type=t;		main = m;		if (type==4) {			select_pressed=false;			thread = new Thread(this);			thread.start();		}		String song_name="";		if (main.sound_setting) {			if (type==0){				song_name="/fail.mp3";			}			if (type==1) {				song_name="/request.mp3";			}			if (type==2) {				song_name="/success.mp3";			}			if (type==1|| type==2|| type==0) {				try {					success=getClass().getResourceAsStream(song_name);					p=Manager.createPlayer(success,"audio/mpeg");					p.realize();					p.setLoopCount(1);					VolumeControl volume =(VolumeControl) p.getControl ("VolumeControl");					volume.setLevel(100);					p.start();				}catch (Exception e) {System.out.println(e);}			}		}		init();	}	protected Message(Image p, int t) {		super(true);		preview=p;		type=t;		init();	}	protected Message(String path, String f,String d, long s, boolean h,int t){		super(true);		select_pressed=false;		thread = new Thread(this);		thread.start();		String unit = " KB";		currentpath = path;		file_type = f;		date = d;		if (s > 1024){			s = s/1024;			unit = " MB";		}		size = String.valueOf(s) + unit;		hidden = h;		type = t;		init();	}	private void init(){		screenWidth= 176;		screenHeight=220;		temp2 = screenHeight*28/100;		font = Font.getFont (Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);		font_title = Font.getFont (Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE);		progress_h=screenHeight/20+font_title.getHeight()+1;		g=this.getGraphics();		setFullScreenMode(true);		//lay.setPosition(0,0);		//lay.setVisible(true);		draw();	}	private void draw_image(String image_name, int x, int y){		Image pic =null;		try{			pic =Image.createImage("/"+image_name);		} catch (IOException e) {			System.out.println ("load png resource error" + e.getMessage());		}		g.drawImage (pic, x, y, Graphics.TOP | Graphics.LEFT);	}	public void draw() {		//drawing		String temp="";		int k=0;		int j=0;		int b=0;		g.setColor(255,255,255);		g.fillRect(0,0,screenWidth,screenHeight);		g.setColor(255,190,33);		g.fillRect(0,0,screenWidth,screenHeight/20);		g.fillRect(0,screenHeight-screenHeight/20,screenWidth,screenHeight/20);		g.setFont(font_title);		g.setColor(0,0,0);		if (type==0){			draw_image("cross.png",screenWidth*5/100,screenHeight/20*2);			g.drawString("Fail",screenWidth*30/100 ,screenHeight*12/100 ,Graphics.TOP|Graphics.LEFT);			draw_content(content,temp2);		}		if (type ==1) {			draw_image("question.png",screenWidth*5/100,screenHeight/20*2);			g.drawString("Request",screenWidth*30/100 ,screenHeight*12/100 ,Graphics.TOP|Graphics.LEFT);			draw_content(content,temp2);		}		if (type ==2) {			draw_image("sucess.png",screenWidth*5/100,screenHeight/20*2);			g.drawString("Success",screenWidth*30/100 ,screenHeight*12/100 ,Graphics.TOP|Graphics.LEFT);			draw_content(content,temp2);		}		if (type==3) {			g.drawString ("File Details",screenWidth*5/100,screenHeight*5/100,Graphics.TOP|Graphics.LEFT );			temp2 =screenHeight*15/100;			l=1;			g.setFont(font);			display_text[0]="Current Path:";			currentpath=currentpath+"\\";			if (font.stringWidth(currentpath) >screenWidth*9/10){				for (int i=0; i<currentpath.length(); i++) {						temp=currentpath.substring(k,i);						if (font.stringWidth(temp) >screenWidth*9/10){							temp = currentpath.substring(k,j);							display_text[l]=temp;							l++;							k=j;							temp=currentpath.substring(k,currentpath.length());							if (font.stringWidth(temp) <=screenWidth*9/10) {								temp=temp.substring(0,temp.length()-1);								display_text[l]=temp;								break;							}						}						j=i;					}			}else {				display_text[l]=currentpath.substring(0,currentpath.length()-1);			}			display_text[l+1]="Modify Date:";			String d;			d=date.substring(0,10)+" "+date.substring(date.length()-4,date.length());			display_text[l+2]=d;			d=date.substring(11,20);			display_text[l+3]=d;			display_text[l+4]="File type:";			display_text[l+5]=file_type;			display_text[l+6]="File size:";			display_text[l+7]=size;			display_text[l+8]="Hidden File:";			if (hidden){				display_text[l+9]="true";			}else{				display_text[l+9]="false";

⌨️ 快捷键说明

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