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

📄 guest_imageitems.java

📁 运用HTTPCONNECTION做一个简单的聊天程序
💻 JAVA
字号:
package datagram003packet;

import javax.microedition.lcdui.*;//use ui

public class Guest_ImageItems extends Form implements CommandListener,
		ItemCommandListener {
	private ImageItem imageItem[]=new ImageItem[6];
	private Command command[]=new Command[6];
	private Command backCommand;
	private Display display;
	private Guest guest;
	public Guest_ImageItems(Display display,Guest guest)
	{
		super("Please Select Your Images");
		this.display=display;
		this.guest=guest;
		 for(int i=0;i<imageItem.length;i++)
    	 {
    		 imageItem[i]=new ImageItem(null,null,ImageItem.LAYOUT_LEFT,"无法显示图片");
    		 command[i]=new Command("Select"+i,Command.OK,1);
    		 imageItem[i].setDefaultCommand(command[i]);
    	 }
    	 backCommand=new Command("Back",Command.BACK,1);
    	 
    	 imageItem[0].setImage(getImages("/7.PNG"));
    	  this.append(imageItem[0]);
    	// this.addCommand(command[0]);
    	 imageItem[0].setItemCommandListener(this);
    	 
    	 imageItem[1].setImage(getImages("/8.PNG"));
    	 
    	 this.append(imageItem[1]);
    	 imageItem[1].setItemCommandListener(this);
    	// this.addCommand(command[1]);
    	 
    	 imageItem[2].setImage(getImages("/9.PNG"));
    	
    	 this.append(imageItem[2]);
    	 imageItem[2].setItemCommandListener(this);
    	 //this.addCommand(command[2]);
    	 
    	 imageItem[3].setImage(getImages("/10.PNG"));
    	
    	 this.append(imageItem[3]);
    	 imageItem[3].setItemCommandListener(this);
    	 //this.addCommand(command[3]);
    	 
    	 imageItem[4].setImage(getImages("/11.PNG"));
    
    	 this.append(imageItem[4]);
    	 imageItem[4].setItemCommandListener(this);
    	 //this.addCommand(command[4]);
    	 
    	 imageItem[5].setImage(getImages("/12.PNG"));
    	
    	 this.append(imageItem[5]);
    	 imageItem[5].setItemCommandListener(this);
    	 //this.addCommand(command[5]);
    	 
    	 this.addCommand(backCommand);
    	 this.setCommandListener(this);
	}
///
	public Image getImages(String str)
	{
		Image imag=null;
		try
		{
			imag=Image.createImage(str);
		}
		catch(Exception e)
		{
			e.printStackTrace();
	    }
		return imag;
	}
	public void commandAction(Command c, Displayable arg1) {
		// TODO 自动生成方法存根
		if(c==backCommand)
		{
			display.setCurrent(this.guest);
		}

	}

	public void commandAction(Command c, Item arg1) {
		// TODO 自动生成方法存根
       if(c==command[0])
       {
    	   guest.img_path="/7.PNG";
       }
       if(c==command[1])
       {
    	   guest.img_path="/8.PNG";
       }
       if(c==command[2])
       {
    	   guest.img_path="/9.PNG";
       }
       if(c==command[3])
       {
    	   guest.img_path="/10.PNG";
       }
       if(c==command[4])
       {
    	   guest.img_path="/11.PNG";
       }
       if(c==command[5])
       {
    	   guest.img_path="/12.PNG";
       }
	}

}

⌨️ 快捷键说明

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