Kod
import javax.microedition.midlet.MIDlet;
import com.sun.lwuit.Command;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Image;
import com.sun.lwuit.Label;
import com.sun.lwuit.List;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
public class Kraje extends MIDlet implements ActionListener {
private Form form_list, form_item;
private Command com_exit=new Command("koniec");
private Command com_show=new Command("pokaż");
private Command com_back=new Command("powrót");
private String tab[]=new String[10];
private String tab_items[][]=new String [10][10];
private Image img;
private Image tab_img[]=new Image [10];
private List list;
public void startApp(){
Display.init(this);
try{
Resources res=Resources.open("/theme_kraje.res");
UIManager.getInstance().setThemeProps(res.getThemeResourceNames()[0]);
}catch (Exception e){
System.out.println("Nie można załadować pliku.");
}
tab=new String []{"Polska", "Australia", "Brazylia", "Grecja", "Hiszpania", "Iran", "Japonia", "Kanada", "Kolumbia", "Zair"};
tab_items=new String[][]{
{"Warszawa","polski","złoty polski"},
{"Canaberra","angielski","dolar australijski"},
{"Brasilia","portugalski","real brazylijski"},
{"Ateny","grecki","euro"},
{"Madryt","hiszpański","euro"},
{"Teheran","perski","rial irański"},
{"Tokio","japoński","jen"},
{"Ottawa","angielski,francuski","dolar kanadyjski"},
{"Bogota","hiszpański","peso kolumbijskie"},
{"Kinszasa","francuski","zair"},
};
try{
for (int i=0; i<tab_img.length; i++){
img=Image.createImage("/"+tab[i]+",png");
tab_img[i]=img;
}
}catch (Exception e){
System.out.println("Nie można załadować pliku\n");
}
form_list=new Form("Kraje");
form_list.addComponent(list);
form_list.addCommand(com_exit);
form_list.addCommand(com_show);
form_list.setCommandListener(this);
form_list.show();
}
public void pauseApp(){}
public void destroyApp(boolean unconditional) {}
public void actionPerformed(ActionEvent ae) {
if(ae.getCommand()==com_exit){
try
{
destroyApp(false);
notifyDestroyed();
}catch (Exception e){
e.printStackTrace();}
}
else if(ae.getCommand()==com_show){
int index=list.getSelectedIndex();
String item=list.getSelectedItem().toString();
form_item=new Form(item);
String capital=tab_items[index][0];
String lang=tab_items[index][1];
String currency=tab_items[index][2];
Label lab_img=new Label(tab_img[index]);
form_item.addComponent(lab_img);
Label lab_capital=new Label("stolica:"+capital);
form_item.addComponent(lab_capital);
Label lab_lang=new Label("język:"+lang);
form_item.addComponent(lab_lang);
Label lab_currency=new Label("waluta:"+currency);
form_item.addComponent(lab_currency);
form_item.addCommand(com_exit);
form_item.addCommand(com_back);
form_item.setCommandListener(this);
form_item.show();
}
else if (ae.getCommand()==com_back){
form_list.show();
}
}
}Console
Installing suite from: http://127.0.0.1:53040/PhoneProject.jad [WARN] [rms ] javacall_file_open: _wopen failed for: C:\Users\xxx\javame-sdk\3.0\work\0\appdb\_delete_notify.dat ****warning**** ****Untrusted user classes must never be put ****on the system class path ****warning**** TRACE: <at java.lang.Error: Unresolved compilation problem: The method setThemeProps(Hashtable) in the type UIManager is not applicable for the arguments (String) >, startApp threw an Exception java.lang.Error: Unresolved compilation problem: \n\tThe method setThemeProps(Hashtable) in the type UIManager is not applicable for the arguments (String)\n - Kraje.startApp(), bci=6 - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1 - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7 - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269 - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52 - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8 - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161 - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26 java.lang.Error: Unresolved compilation problem: \n\tThe method setThemeProps(Hashtable) in the type UIManager is not applicable for the arguments (String)\n - Kraje.startApp(), bci=6 - javax.microedition.midlet.MIDletTunnelImpl.callStartApp(), bci=1 - com.sun.midp.midlet.MIDletPeer.startApp(), bci=7 - com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=269 - com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52 - com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8 - com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161 - com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26
Czy ktoś ma jakikolwiek pomysł dlaczego ten program nie działa i co zrobić by zadziałał?
Z góry dziękuję za pomoc.
Pozdrawiam.

Logowanie »
Rejestracja
Pomoc
Dodaj odpowiedź
Cytuj