// ITU F05-JMA - Homework week 01 // HelloWorld.java // 2005-02-06 Kenn A. Thisted import javax.microedition.midlet.MIDlet; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet { private Display display; private TextBox mainScreen; public HelloWorld() { display = Display.getDisplay(this); // 2. Modify HelloWorld so it displays the string "Hello " mainScreen = new TextBox("Hello World", "Hello Kenn", 512, 0); // 3. Is there a method for determining whether the device running an application has a color display? System.out.println("Display: " + display.numColors() + " " + (display.isColor() ? "colors" : "greys")); // 4. How many chars you have written so far and how many available chars you have System.out.println("Used " + mainScreen.size() + " out of " + mainScreen.getMaxSize() + " chars"); } public void startApp() { display.setCurrent(mainScreen); } public void pauseApp() { } public void destroyApp(boolean unconditional) { // 5. Is it possible to retrieve (read) the changed text (string) from the program? System.out.println("Text: " + mainScreen.getString()); } }