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

📄 hellomidlet.java

📁 短信群发工具,基于J2ME实现的手机群发
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    }//GEN-END:MVDGetEnd63

    /** This method returns instance for itemCommand1 component and should be called instead of accessing itemCommand1 field directly.//GEN-BEGIN:MVDGetBegin65
     * @return Instance for itemCommand1 component
     */
    public Command get_itemCommand1() {
        if (itemCommand1 == null) {//GEN-END:MVDGetBegin65
            // Insert pre-init code here
            itemCommand1 = new Command("\u9879", Command.ITEM, 1);//GEN-LINE:MVDGetInit65
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd65
        return itemCommand1;
    }//GEN-END:MVDGetEnd65

    /** This method returns instance for okCommand11 component and should be called instead of accessing okCommand11 field directly.//GEN-BEGIN:MVDGetBegin67
     * @return Instance for okCommand11 component
     */
    public Command get_okCommand11() {
        if (okCommand11 == null) {//GEN-END:MVDGetBegin67
            // Insert pre-init code here
            okCommand11 = new Command("\u786E\u5B9A", Command.OK, 1);//GEN-LINE:MVDGetInit67
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd67
        return okCommand11;
    }//GEN-END:MVDGetEnd67

    /** This method returns instance for itemCommand2 component and should be called instead of accessing itemCommand2 field directly.//GEN-BEGIN:MVDGetBegin69
     * @return Instance for itemCommand2 component
     */
    public Command get_itemCommand2() {
        if (itemCommand2 == null) {//GEN-END:MVDGetBegin69
            // Insert pre-init code here
            itemCommand2 = new Command("\u9879", Command.ITEM, 1);//GEN-LINE:MVDGetInit69
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd69
        return itemCommand2;
    }//GEN-END:MVDGetEnd69

    /** This method returns instance for component1 component and should be called instead of accessing component1 field directly.//GEN-BEGIN:MVDGetBegin71
     * @return Instance for component1 component
     */
    public Command get_component1() {
        if (component1 == null) {//GEN-END:MVDGetBegin71
            // Insert pre-init code here
            component1 = new Command("\u5C4F\u5E55", Command.OK, 1);//GEN-LINE:MVDGetInit71
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd71
        return component1;
    }//GEN-END:MVDGetEnd71

    /** This method returns instance for itemCommand3 component and should be called instead of accessing itemCommand3 field directly.//GEN-BEGIN:MVDGetBegin73
     * @return Instance for itemCommand3 component
     */
    public Command get_itemCommand3() {
        if (itemCommand3 == null) {//GEN-END:MVDGetBegin73
            // Insert pre-init code here
            itemCommand3 = new Command("\u9879", Command.ITEM, 1);//GEN-LINE:MVDGetInit73
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd73
        return itemCommand3;
    }//GEN-END:MVDGetEnd73
 
    /** This method returns instance for okCommand12 component and should be called instead of accessing okCommand12 field directly.//GEN-BEGIN:MVDGetBegin76
     * @return Instance for okCommand12 component
     */
    public Command get_okCommand12() {
        if (okCommand12 == null) {//GEN-END:MVDGetBegin76
            // Insert pre-init code here
            okCommand12 = new Command("\u786E\u5B9A", Command.OK, 1);//GEN-LINE:MVDGetInit76
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd76
        return okCommand12;
    }//GEN-END:MVDGetEnd76

    /** This method returns instance for list4 component and should be called instead of accessing list4 field directly.//GEN-BEGIN:MVDGetBegin78
     * @return Instance for list4 component
     */
    public List get_list4() {
        if (list4 == null) {//GEN-END:MVDGetBegin78
            // Insert pre-init code here
            list4 = new List("\u9009\u62E9\u5206\u7EC4", Choice.IMPLICIT, new String[0], new Image[0]);//GEN-BEGIN:MVDGetInit78
            list4.addCommand(get_okCommand13());
            list4.addCommand(get_exitCommand3());
            list4.setCommandListener(this);
            list4.setSelectedFlags(new boolean[0]);
            list4.setSelectCommand(get_okCommand13());//GEN-END:MVDGetInit78
            // Insert post-init code here
            for(int i=0;i<tel.xzfs.length;i++){
                list4.append(tel.xzfs[i],null);
            }
        }//GEN-BEGIN:MVDGetEnd78
        return list4;
    }//GEN-END:MVDGetEnd78

    /** This method returns instance for okCommand13 component and should be called instead of accessing okCommand13 field directly.//GEN-BEGIN:MVDGetBegin80
     * @return Instance for okCommand13 component
     */
    public Command get_okCommand13() {
        if (okCommand13 == null) {//GEN-END:MVDGetBegin80
            // Insert pre-init code here
            okCommand13 = new Command("\u786E\u5B9A", Command.OK, 1);//GEN-LINE:MVDGetInit80
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd80
        return okCommand13;
    }//GEN-END:MVDGetEnd80

    /** This method returns instance for list5 component and should be called instead of accessing list5 field directly.//GEN-BEGIN:MVDGetBegin82
     * @return Instance for list5 component
     */
    public List get_list5() {
        if (list5 == null) {//GEN-END:MVDGetBegin82
            // Insert pre-init code here
            list5 = new List("\u9009\u62E9\u4EBA\u5458", Choice.IMPLICIT, new String[0], new Image[0]);//GEN-BEGIN:MVDGetInit82
            list5.addCommand(get_okCommand14());
            list5.addCommand(get_backCommand6());
            list5.setCommandListener(this);
            list5.setSelectedFlags(new boolean[0]);
            list5.setSelectCommand(get_okCommand14());//GEN-END:MVDGetInit82
            try {
                // Insert post-init code here
                int li_int=0;
                for(int i=0;i<tel.hm.length;i++){
                    if(tel.sarry[Integer.parseInt(tel.hm[i][1])]){
                        String num = "";
                        String ls ="";
                        num = Integer.toString(i);
                        for(int j=0;j<tel.hmcd - num.length();j++){
                            ls += "0";
                        }
                        num = ls + num;
                        li_int = list5.append(num + " " + tel.hm[i][2] + " " + tel.hm[i][0],null);
                    }
                }
            } catch (NumberFormatException ex) {
                ex.printStackTrace();
                list5.setTitle(ex.toString());
            }
        }//GEN-BEGIN:MVDGetEnd82
        return list5;
    }//GEN-END:MVDGetEnd82

    /** This method returns instance for okCommand14 component and should be called instead of accessing okCommand14 field directly.//GEN-BEGIN:MVDGetBegin85
     * @return Instance for okCommand14 component
     */
    public Command get_okCommand14() {
        if (okCommand14 == null) {//GEN-END:MVDGetBegin85
            // Insert pre-init code here
            okCommand14 = new Command("\u547C\u53EB", Command.OK, 1);//GEN-LINE:MVDGetInit85
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd85
        return okCommand14;
    }//GEN-END:MVDGetEnd85

    /** This method returns instance for backCommand6 component and should be called instead of accessing backCommand6 field directly.//GEN-BEGIN:MVDGetBegin87
     * @return Instance for backCommand6 component
     */
    public Command get_backCommand6() {
        if (backCommand6 == null) {//GEN-END:MVDGetBegin87
            // Insert pre-init code here
            backCommand6 = new Command("\u540E\u9000", Command.BACK, 1);//GEN-LINE:MVDGetInit87
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd87
        return backCommand6;
    }//GEN-END:MVDGetEnd87

    /** This method returns instance for backCommand7 component and should be called instead of accessing backCommand7 field directly.//GEN-BEGIN:MVDGetBegin89
     * @return Instance for backCommand7 component
     */
    public Command get_backCommand7() {
        if (backCommand7 == null) {//GEN-END:MVDGetBegin89
            // Insert pre-init code here
            backCommand7 = new Command("\u540E\u9000", Command.BACK, 1);//GEN-LINE:MVDGetInit89
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd89
        return backCommand7;
    }//GEN-END:MVDGetEnd89

    /** This method returns instance for exitCommand2 component and should be called instead of accessing exitCommand2 field directly.//GEN-BEGIN:MVDGetBegin91
     * @return Instance for exitCommand2 component
     */
    public Command get_exitCommand2() {
        if (exitCommand2 == null) {//GEN-END:MVDGetBegin91
            // Insert pre-init code here
            exitCommand2 = new Command("\u9000\u51FA", Command.EXIT, 1);//GEN-LINE:MVDGetInit91
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd91
        return exitCommand2;
    }//GEN-END:MVDGetEnd91

    /** This method returns instance for okCommand15 component and should be called instead of accessing okCommand15 field directly.//GEN-BEGIN:MVDGetBegin93
     * @return Instance for okCommand15 component
     */
    public Command get_okCommand15() {
        if (okCommand15 == null) {//GEN-END:MVDGetBegin93
            // Insert pre-init code here
            okCommand15 = new Command("\u786E\u5B9A", Command.OK, 1);//GEN-LINE:MVDGetInit93
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd93
        return okCommand15;
    }//GEN-END:MVDGetEnd93

    /** This method returns instance for backCommand8 component and should be called instead of accessing backCommand8 field directly.//GEN-BEGIN:MVDGetBegin95
     * @return Instance for backCommand8 component
     */
    public Command get_backCommand8() {
        if (backCommand8 == null) {//GEN-END:MVDGetBegin95
            // Insert pre-init code here
            backCommand8 = new Command("\u540E\u9000", Command.BACK, 1);//GEN-LINE:MVDGetInit95
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd95
        return backCommand8;
    }//GEN-END:MVDGetEnd95

    /** This method returns instance for exitCommand3 component and should be called instead of accessing exitCommand3 field directly.//GEN-BEGIN:MVDGetBegin97
     * @return Instance for exitCommand3 component
     */
    public Command get_exitCommand3() {
        if (exitCommand3 == null) {//GEN-END:MVDGetBegin97
            // Insert pre-init code here
            exitCommand3 = new Command("\u9000\u51FA", Command.EXIT, 1);//GEN-LINE:MVDGetInit97
            // Insert post-init code here
        }//GEN-BEGIN:MVDGetEnd97
        return exitCommand3;
    }//GEN-END:MVDGetEnd97
    
    public void startApp() {
        getDisplay().setCurrent(resumeScreen);
    }
    
    public void pauseApp() {
        resumeScreen = getDisplay().getCurrent();
    }
    
    public void destroyApp(boolean unconditional) {
    }
    public void run() {
        
        String address ;
        String fszt="";
        int errRetryCount = 2;
        int errRetry = 0;
        MessageConnection smsconn = null;
        
        for(int i=0;i<tel.hm.length;i++){
            
            if(tel.fshm[i]){
                try {
                    Thread.sleep(2000);
                    form1.setTitle("发送:"+tel.hm[i][2]);
                    /** Open the message connection. */
                    
                    address = "sms://" + tel.hm[i][0];
                    smsconn = (MessageConnection)Connector.open(address);
                    TextMessage txtmessage = (TextMessage)smsconn.newMessage(
                            MessageConnection.TEXT_MESSAGE);
                    txtmessage.setAddress(address);
                    txtmessage.setPayloadText(textBox1.getString());
                    smsconn.send(txtmessage);
                    fszt = "\n" + tel.hm[i][2]+ " 已发送"  + address + fszt;
                    stringItem1.setText(fszt);
                } catch (Throwable t) {
                    System.out.println("Send caught: ");
                    t.printStackTrace();
                    fszt = "\n" + tel.hm[i][2]+ " 发送错误:" + t.toString() + fszt;
                    stringItem1.setText(fszt);
                    if(errRetry<errRetryCount){
                        errRetry++;
                        fszt = "\n重发 " + tel.hm[i][2]+ " 第" + Integer.toString(errRetry)
                                + "次"+ fszt;
                        i--;
                    }else{
                        errRetry = 0;
                    }
                }
                if (smsconn != null) {
                    try {
                        smsconn.close();
                    } catch (IOException ioe) {
                        System.out.println("Closing connection caught: ");
                        ioe.printStackTrace();
                        fszt = "\n" + ioe.toString() + fszt;
                        stringItem1.setText(fszt);
                    }
                }
            }
        }
        fszt = "\n发送完成!" + fszt;
        stringItem1.setText(fszt);
        form1.setTitle("支队短信群发");
    } 
}

⌨️ 快捷键说明

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