⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 progressform.java

📁 J2ME的游戏原代码!希望能帮助有需要帮助的师兄弟们!
💻 JAVA
字号:
/*
 * @(#)ProgressForm.java 1.7
 *
 * Copyright (c) 2001-2004 Sony Ericsson Mobile Communication AB (SEMC).
 *
 * German Branch
 * Heisenbergbogen 1, Aschheim 85609, Munich, Germany.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * SEMC. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with SEMC.
 *
 * @author  Rohit.
 * @version 1.7, 10/10/2003
*/


package com.sonyericsson.erix;

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
//import javax.microedition.rms.*;
import javax.microedition.io.*;
//import java.io.*;


public class ProgressForm extends Form implements CommandListener {

    private StringItem messageStringItem;
    private Command cancelCommand;
    private Command cancelDummyCommand;

    private HTTPScoreTransmitter scoreTransmitter;
    private ErixMIDlet midlet;

    // Constructor
    ProgressForm(HTTPScoreTransmitter scoreTransmitter, ErixMIDlet midlet) {

        super(midlet.m_objGameCanvas.m_arrLanguageStrings[
                midlet.m_objGameCanvas.HIGHSCORES_UPLOAD_PROGRESS_TITLE_STR]);

        // Use the parameters received to set the data members of the object.
        this.scoreTransmitter = scoreTransmitter;
        this.midlet = midlet;

        // Create the content (message) to be displayed on the form.
        messageStringItem = new StringItem("",
            midlet.m_objGameCanvas.m_arrLanguageStrings[
                    midlet.m_objGameCanvas.HIGHSCORES_UPLOAD_PROGRESS_STR]);
        // Associate the content with the form.
        append(messageStringItem);

        // Create the command to be available on the form
        cancelCommand = new Command(midlet.m_objGameCanvas.m_arrLanguageStrings[
                        midlet.m_objGameCanvas.CANCEL_STR],
                    Command.SCREEN, 1);
        cancelDummyCommand = new Command(midlet.m_objGameCanvas.m_arrLanguageStrings[
                        midlet.m_objGameCanvas.CANCEL_STR],
                    Command.CANCEL, 1);
        // Associate the command wih the form, and set a command listener.
        addCommand(cancelCommand);
        setCommandListener(this);

        Thread t = new Thread(this.scoreTransmitter);
        t.start();
    } // end of constructor


    /**
     * Handles the potential command from the user to
     * cancel the highscores upload.
     */
    public void commandAction(Command c,
                                   Displayable d){
        // Indicate to the HTPScoreTransmitter thread that
        // the uplopad operation is to be cancelled.
        scoreTransmitter.m_nHighScoreStatus
            = scoreTransmitter.UPLOAD_CANCELLED;

        // Close the connection.
        try {
            // Cancel the highscores upload:
            // Close the HTTPConnection
            scoreTransmitter.m_objConnection.close();
        } catch (Exception e) {
        }
    } // end of method commandAction


    /**
     * Invoked by the HTTPScoreTransmitter thread when the upload operation
     * ends (in success or in failure).
     */
    public void uploadOperationCompleted() {
        // Switch to the highscores upload result screen.
        midlet.m_objGameCanvas.update(
            midlet.m_objGameCanvas.HIGHSCORES_UPLOAD_RESULT_SCREEN);
    } // end of method uploadOperationCompleted
} //end of class ProgressForm

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -