Jūs esate

My first JavaME program aka Hello, World on Mobile phone

I wanted to try the JavaME framework. And I tried it. The first program I made was a simple program which shows an alert box with the text you entered. Interesting point is that the menu buttons look different then in my "Sony Ericsson K550i". In the emulator - the "Exit" is on the right, but in my mobile phone it's on the left. At the moment I don't have any idea why, but... Well, we'll see :) [code lang="java"] package helloworld; import javax.microedition.lcdui.*; import javax.microedition.lcdui.CommandListener; import javax.microedition.midlet.*; /** * @author Ernestas Kardzys */ public class Midlet extends MIDlet implements CommandListener { private Display display; private Form mainForm; private TextBox textBox; private Command quitCommand; private Command backCommand; private Command alertCommand; private Command textboxCommand; /** * Called by the system to start our MIDlet. */ public void startApp() { display = Display.getDisplay(this); quitCommand = new Command("Exit", Command.EXIT, 1); backCommand = new Command("Back", Command.BACK, 1); alertCommand = new Command("Alert", Command.SCREEN, 2); textboxCommand = new Command("Show textbox", Command.SCREEN, 3); mainForm = new Form("Main form!"); mainForm.addCommand(quitCommand); mainForm.addCommand(alertCommand); mainForm.addCommand(textboxCommand); mainForm.setCommandListener(this); textBox = new TextBox("SimpleTextBox", "", 100, 0); textBox.setCommandListener(this); textBox.addCommand(alertCommand); textBox.addCommand(backCommand); textBox.setCommandListener(this); display.setCurrent(mainForm); } /** * Called by the system to pause our MIDlet. */ public void pauseApp() { } /** * Called by the system to end our MIDlet. */ public void destroyApp(boolean unconditional) { } public void commandAction(Command choice, Displayable displayable) { if (choice == quitCommand) { destroyApp(false); notifyDestroyed(); } else if (choice == backCommand) { display.setCurrent(mainForm); } else if (choice == textboxCommand) { display.setCurrent(textBox); } else if (choice == alertCommand) { if (textBox.getString().trim().length() > 0) { Alert alert = new Alert(textBox.getString()); alert.setTimeout(5000); textBox.setString(""); display.setCurrent(alert); } } } } [/code] The next message in the JavaME section will be about how to send the SMS by using your mobile phone and JavaME :)


Būtų šaunu sukompiliuotas daiktas :) bet koks nors screenas to tavo softo, nes mintyse nusipiešt nesigavo :D

Dėkui už pastabą ;) SMS siuntėjui pridėsiu ir sukompiliuotą daiktą :)

Prix Cialis Pharmacie Suisse <a href=http://cialibuy.com>Cialis</a> Cialis Pils Cost

Comprar Cialis Lilly http://buycialisuss.com - Cialis Viagra Que Significa <a href=http://buycialisuss.com>Buy Cialis</a> Cephalexin Monohydrate Shelf Life