/* * Copyright © 2011 Nokia Corporation. All rights reserved. * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation. * Oracle and Java are trademarks or registered trademarks of Oracle and/or its * affiliates. Other product and company names mentioned herein may be trademarks * or trade names of their respective owners. * See LICENSE.TXT for license information. */ package com.nokia.example.capitals.ui; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.StringItem; import com.nokia.example.capitals.CapitalMIDlet; /** * This class presents the results of the remote call to the user */ public class ResultScreen extends Screen { private Command exitCommand, backCommand; public ResultScreen(CapitalMIDlet midlet, String nation, String capital) { super(midlet); // create the results form Form f = new Form("Result"); f.append(new StringItem("Nation", nation)); f.append(new StringItem("Capital", capital)); displayable = f; // add commands exitCommand = new Command("Exit", Command.EXIT, 0); backCommand = new Command("Back", Command.BACK, 0); displayable.addCommand(exitCommand); displayable.addCommand(backCommand); displayable.setCommandListener(this); } public void commandAction(Command c, Displayable d) { if (c == exitCommand) { midlet.quit(); } else if (c == backCommand) { // Go back midlet.showMainScreen(); } } }