How to set ImageItems ! ! !
Hi friends,
In my Form i have 2 ImageItems,I want both should be in Center and parallel to each other(Horizontally). For that i used
image1, Item.LAYOUT_LEFT | Item.LAYOUT_CENTER
image2, Item.LAYOUT_RIGHT | Item.LAYOUT_CENTER
Butthey r not taking right places .
Plz tell me what should i do for this so that both Images be in center n llel to eachother.
Best regards
karan
[421 byte] By [
karan88a] at [2007-11-26 23:43:27]

# 4
*/
public class ListScreen extends Form implements CommandListener,ItemCommandListener{
public MobileClientMIDlet parent;
public static String USERID ;
private Spacer spacer;
MyCustomItem custom=null;
public boolean focused;
private ImageItem timesheetImage;
private ImageItem reportImage;
StringItem strItem = null;
private ImageItem manteamImage,mansoftImage;
Image image=null,image2=null;
private static final Command okCommand = new Command("OK", Command.ITEM, 1);
private static final Command exitCommand = new Command("Exit", Command.EXIT, 3);
private static final Command backCommand = new Command("Back", Command.BACK, 0);
public ListScreen(MobileClientMIDlet parent,String USERID) {
super("");
this.parent=parent;
this.USERID=USERID;
ProjectListForm projectlist=new ProjectListForm(parent,USERID);
try {
image = Image.createImage("/mansoftMobileSolution/images/manteam.JPG");
} catch (Exception e) {e.getMessage();}
manteamImage = new ImageItem("", image, Item.LAYOUT_TOP |Item.LAYOUT_CENTER,
"", Item.PLAIN);
append(manteamImage);
strItem=new StringItem("Welcome Mr.",USERID);
strItem.setLayout(Item.LAYOUT_CENTER | Item.LAYOUT_TOP | Item.LAYOUT_NEWLINE_AFTER | Item.LAYOUT_NEWLINE_BEFORE);
append(strItem);
spacer = new Spacer(0,10);
spacer.setLayout(Item.LAYOUT_NEWLINE_BEFORE);
append(spacer);
boolean firstTime = true;
if (firstTime) {
// Loads the image
Image image1=null,image2 = null;
try {
image1 = Image.createImage("/mansoftMobileSolution/images/time.jpg");
} catch (Exception e) {}
// Loads the image
try {
image2 = Image.createImage("/mansoftMobileSolution/images/report.jpg");
} catch (Exception e) {}
//Creates a HYPERLINK image item
timesheetImage = new ImageItem("timesheet", image1, Item.LAYOUT_LEFT |Item.LAYOUT_DEFAULT ,
"", Item.HYPERLINK);
//spacer = new Spacer(0, 20);
//append(spacer);
//Creates a HYPERLINK image item
reportImage = new ImageItem("report", image2, Item.LAYOUT_RIGHT |Item.LAYOUT_DEFAULT,
"", Item.HYPERLINK);
append(timesheetImage);
spacer = new Spacer(0, 30);
append(spacer);
append(reportImage);
spacer = new Spacer(0,0);
spacer.setLayout(Item.LAYOUT_NEWLINE_BEFORE);
append(spacer);
try {
image2 = Image.createImage("/mansoftMobileSolution/images/mansoft.png");
} catch (Exception e) {}
//append("Developed by ");
mansoftImage = new ImageItem("Developed by", image2, Item.LAYOUT_BOTTOM |Item.LAYOUT_CENTER,
"", Item.PLAIN);
append(mansoftImage);
addCommand(backCommand);
addCommand(exitCommand);
//Specifies commands for HYPERLINK and BUTTON ImageItems
timesheetImage.setDefaultCommand(okCommand);
reportImage.setDefaultCommand(okCommand);
// Registers the CommandListener
setCommandListener(this);
timesheetImage.setItemCommandListener(this);
reportImage.setItemCommandListener(this);
firstTime = false;
}
}
best regard
karan