2009-09-14

Code snippet to add images to Lists in J2ME


try { 
 // Load the images to Image arrays

 image=new Image[]{Image.createImage("/picture/image1.png"), Image.createImage("/picture/image2.png"), Image.createImage("/picture/image3.png")};

 image2=new Image[]{Image.createImage("/picture/search_server.PNG"), Image.createImage("/picture/Calendar.png")};
}

catch (IOException ex) {
 ex.printStackTrace(); 
}

//Multiple choice Selection
cri=new List("Select Search Method", List.MULTIPLE, search, image);

//Implicit Selection
menu=new List("Select:", List.IMPLICIT, choices, image2);

No comments: