HelloWorld2
Today is a brief and simple post to describe a "real" Hello World application. It prints a message inside the main window. That's it.
The code was taken from the wabasoft.com article about how to write a simple program.
Continuing with my favorite software at the moment, I used MobileCreator to create a new project. First time I got repeated errors because I chose to not let the project wizard create a main window class automatically for me. As a result I was unable to add a class later. The easy workaround until I figure out what's really going on, was to create the project again, and let it create a main window class for me.
I called it HelloWorld2, and used the following code...
import waba.ui.*;
import waba.fx.*;
public class HelloWorld2 extends MainWindow {
public void onPaint(Graphics g) {
g.setColor(0,0,0);
g.drawText("Hello SuperWaba World!",0,0);
}
}
Notice that I've made another discovery... how to format code in this blog! Turns out that I have to paste it into MS Word first. Then cut and paste into the blog. Don't ask me what changes, but it seems to work!
I ran it with the "green flag" button, and it ran in the applet first time no problem! I changed the dropdown box to use the Palm TE simulator. Works like a charm in the simulator also!!
This whole experiment and blog entry probably took me about 10mins total. Life is good!
I haven't decided what comes next, but have ordered the tutorials for SuperWaba. Will make a decision based on what those look like.
0 Comments:
Post a Comment
<< Home