11-27-2010 08:28 AM
Hello all,
I have studied a user interface document and try this following program. I'm using Eclipse with Blackberry plugin. And Emulator is BlackBerry 9800.
When i run this code...the .png images are not displayed in my emulator. But other labels and Buttons are displayed correctly.Please tell me what is the error in my coding.
Hello all,
I have studied a user interface document and try this following program. I'm using Eclipse with Blackberry plugin. And Emulator is BlackBerry 9800.
When i run this code...the .png images are not displayed in my emulator. But other labels and Buttons are displayed correctly.Please tell me what is the error in my coding.
My Coding:
Hello all,
I have studied a user interface document and try this following program. I'm using Eclipse with Blackberry plugin. And Emulator is BlackBerry 9800.
When i run this code...the .png images are not displayed in my emulator. But other labels and Buttons are displayed correctly.Please tell me what is the error in my coding.
My Coding:
public class InterfaceScreen extends MainScreen {
HorizontalFieldManager h1,h2;
VerticalFieldManager v1;
BitmapField b1;
Bitmap m1,m2,m3;
LabelField l;
BasicEditField e1;
String s1,s2,s3;
int displayed=0;
public InterfaceScreen(){
super();
LabelField l=new LabelField("Ramprasad Application",LabelField.ELLIPSIS|LabelField.USE_AL
setTitle(l);
h1=new HorizontalFieldManager();
v1=new VerticalFieldManager();
h2=new HorizontalFieldManager();
add(h1);
add(new SeparatorField());
add(v1);
add(new SeparatorField());
add(h2);
b1=new BitmapField();
m1=Bitmap.getBitmapResource("C:/Documents and Settings/WELCOME/Desktop/But.png");
m2=Bitmap.getBitmapResource("C:/Documents and Settings/WELCOME/Desktop/eye.png");
m3=Bitmap.getBitmapResource("C:/Documents and Settings/WELCOME/Desktop/paint.png");
b1.setBitmap(m1);
h1.add(b1);
s1="Butterfly";
s2="Eye";
s3="Paint";
l=new LabelField("Please press a Button ");
e1=new BasicEditField("Item Name ", null);
v1.add(l);
v1.add(e1);
FieldChangeListener f1=new FieldChangeListener(){
public void fieldChanged(Field f,int c){
b1.setBitmap(m1);
e1.setText(s1);
displayed=0;
}
};
FieldChangeListener f2=new FieldChangeListener(){
public void fieldChanged(Field f,int c){
b1.setBitmap(m2);
e1.setText(s2);
displayed=1;
}
};
FieldChangeListener f3=new FieldChangeListener(){
public void fieldChanged(Field f,int c){
b1.setBitmap(m3);
e1.setText(s3);
displayed=2;
}
};
ButtonField b1=new ButtonField("Butterfly");
ButtonField b2=new ButtonField(" Eye ");
ButtonField b3=new ButtonField(" Paint ");
b1.setChangeListener(f1);
b2.setChangeListener(f2);
b3.setChangeListener(f3);
h2.add(b1);
h2.add(b2);
h2.add(b3);
}
protected void makemenu(Menu m,int i){
m.add(ChangeItem);
m.add(Close);
}
private MenuItem ChangeItem=new MenuItem("Change Item",110,10){
public void run(){
if(displayed==0)
s1=e1.getText();
else if(displayed==1)
s2=e1.getText();
else if(displayed==2)
s3=e1.getText();
}
};
private MenuItem Close=new MenuItem("Close",110,10){
public void run(){
onClose();
}
};
public boolean onClose(){
Dialog.alert("Bye");
System.exit(0);
return true;
}
}
11-27-2010 02:24 PM
Place your images in the res folder and load as :
m1=Bitmap.getBitmapResource("Desktop/But.png");
11-28-2010 11:24 PM
Thank you...YamilBracho...i used import option in file.I run my program with images successfully....