加拿大华人论坛 德国留学移民签证Java 问题 如果没有main方法可以吗
在加拿大
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import java.lang.*;
/**
*
*/
public class Start extends MIDlet implements CommandListener, ItemStateListener {
/** Creates a new instance of StartMidlet */
public Start() {
}
private Form startForm;
private Command exitCommand;
private Command nextCommand;
public String termin;
public String zeit, dozent;
public int selectedType;
public String dozentenNamen[]= {
"C. Womser-Hacker", "R. Koelle", "G. Langemeier", "S. Schlickau", "A. R�,
"M. Camacho-Mohr", "T. Mandl", "F. Jarman", "G. Krei遧", "B. Irwin"};
public String dozentenTermin[] = {
"Dienstag, 14.00 - 15.00", "Dienstag, 10.00 - 11.00", "Freitag, 14.00 - 15.00??","Mittwoch, 13.00 - 14.00","Montag, 14.00 - 15.00",
"Montag, 11.00 - 12.00??", "Dienstag, 14.00 - 15.30", "Dienstag, 14.15 - 15.45\nFreitag, 14.30 - 15.30", "Mittwoch, 15.30 - 16.30", "Dienstag, 10.15 - 11.15"
};
/** This method initializes UI of the application.
*/
private void initialize() {
getDisplay().setCurrent(get_startForm());
}
/** Called by the system to indicate that a command has been invoked on a particular displayable.
* @param command the Command that ws invoked
* @param displayable the Displayable on which the command was invoked
*/
public void commandAction(Command command, Displayable displayable) {
// Insert global pre-action code here
if (displayable == startForm) {
if (command == exitCommand) {
// Insert pre-action code here
exitMIDlet();
// Insert post-action code here
}
}
if (displayable == startForm) {
if (command == nextCommand) {
//Methode f黵 Anmeldung anzeigen
//getDisplay().setCurrent(new Alert("nextCommand",getCaptureSupport("nextCommand"),null,AlertType.INFO));
int zeitIndex= dozentenTermin[selectedType].indexOf(",");
zeit = dozentenTermin[selectedType].substring(zeitIndex+2,zeitIndex+7);
dozent = dozentenNamen[selectedType];
String tag = dozentenTermin[selectedType].substring(0,zeitIndex);
Anmeldung neueAnmeldung = new Anmeldung( this, tag, zeit, dozent, selectedType );
neueAnmeldung.init();
}
}
}
/**
* This method should return an instance of the display.
*/
public Display getDisplay() {
return Display.getDisplay(this);
}
public void setDisplay( Form f) {
getDisplay().setCurrent(f);
}
/**
* This method should exit the midlet.
*/
public void exitMIDlet() {
getDisplay().setCurrent(null);
destroyApp(true);
notifyDestroyed();
}
/** This method returns instance for helloForm component and should be called instead of accessing helloForm field directly.
* @return Instance for helloForm component
*/
public Form get_startForm() {
if (startForm == null) {
startForm = new Form(null, new Item[0]);
startForm.addCommand(get_exitCommand());
startForm.addCommand(get_nextCommand());
startForm.setCommandListener(this);
ChoiceGroup dozenten = new ChoiceGroup("DozentIn* ",4);
// Set our own ItemStateListener
startForm.setItemStateListener(this);
Spacer kleinerSpacer = new Spacer(0,20);
//String termin = termin.setFont(Font.FACE_MONOSPACE, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
try {
ImageItem logoItem = new ImageItem(null, Image.createImage("/StiftungLogo.gif"), ImageItem.LAYOUT_CENTER, "Logo", ImageItem.PLAIN);
startForm.append(kleinerSpacer);
startForm.append(logoItem);
} catch (IOException ex) {
ex.printStackTrace();
}
dozenten.append("- DozentIn ausw鋒len -", null);
for (int i = 0; i < 10; i++){
dozenten.append(dozentenNamen, null);
}
// Zwischenr鋟me
kleinerSpacer = new Spacer(0,100);
startForm.append(kleinerSpacer);
startForm.append(dozenten);
getDisplay().setCurrentItem(dozenten);
}
return startForm;
}
/** This method returns instance for exitCommand component and should be called instead of accessing exitCommand field directly.
* @return Instance for exitCommand component
*/
public Command get_exitCommand() {
if (exitCommand == null) {
// Insert pre-init code here
exitCommand = new Command("Exit", Command.EXIT, 1);
// Insert post-init code here
}
return exitCommand;
}
public Command get_nextCommand() {
if (nextCommand == null) {
// Insert pre-init code here
nextCommand = new Command("Weiter", Command.SCREEN, 1);
// Insert post-init code here
}
return nextCommand;
}
public void startApp() {
initialize();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
public static void main(String[] args)
public void itemStateChanged(Item item) {
if (item instanceof ChoiceGroup) {
termin = "";
//getDisplay().
ChoiceGroup auswahl = (ChoiceGroup)item;
selectedType = auswahl.getSelectedIndex()-1;
dozent = dozentenNamen[selectedType];
if (selectedType>=0 && selectedType<dozentenNamen.length){
termin = " Sprechzeiten: "+dozentenTermin[selectedType]+'\n'+"("+dozent+")";
startForm.append(termin);
}
}
}
}
没法运行啊 哪位帮忙 在哪里添加main?
评论
你这个是Applet 吧
·中文新闻 以色列总理本杰明·内塔尼亚胡在健康恐慌后数小时内接受重大
·中文新闻 彼得·希钦斯:一位英国视频博主因批评乌克兰而失去了人权。