亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ballcanvas.java

?? 手機語音開發
?? JAVA
字號:
/* * * Copyright (c) 2007, Sun Microsystems, Inc. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * *  * Redistributions of source code must retain the above copyright *    notice, this list of conditions and the following disclaimer. *  * Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in the *    documentation and/or other materials provided with the distribution. *  * Neither the name of Sun Microsystems nor the names of its contributors *    may be used to endorse or promote products derived from this software *    without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */package example.audiodemo;import java.io.InputStream;import javax.microedition.lcdui.*;import javax.microedition.media.*;import javax.microedition.media.control.*;public class BallCanvas extends Canvas implements CommandListener {    private BBall midlet;    private Player player;    private int[] notes = { 68, 72, 70, 74, 76, 80, 56, 58 };    private int[] colors =        { 0xff, 0xff00, 0xff0000, 0xffff, 0xff00ff, 0xff8080, 0x80ff80, 0x8080ff };    // a set of free roaming balls    private SmallBall[] balls;    private int numBalls;    private int width;    private int height;    private boolean paused;    private Command backCommand = new Command("Back", Command.BACK, 1);    private Command pauseCommand = new Command("Pause", Command.BACK, 1);    private Command playCommand = new Command("Play", Command.BACK, 1);    private boolean playerCreated;    private int currBackground = -1;    public BallCanvas(BBall parentMidlet) {        midlet = parentMidlet;        width = getWidth();        height = getHeight();        balls = null;        numBalls = 0;        paused = true;        this.addCommand(backCommand);        this.addCommand(pauseCommand);        setCommandListener(this);    }    public synchronized void init(int maxBalls, int bg) {        if (maxBalls < 1) {            maxBalls = 1;        } else if (maxBalls > notes.length) {            maxBalls = notes.length;        }        if ((balls == null) || (player == null) || (balls.length != maxBalls) ||                (currBackground != bg)) {            destroy();            // initialize the array of balls            balls = new SmallBall[maxBalls];            currBackground = bg;            playerCreated = initPlayer(bg);        }        numBalls = 0;        pause();        // Start with 2 balls        makeNumberOfBalls(2);    }    boolean needAlert() {        return (!playerCreated);    }    private static String guessContentType(String url)        throws Exception {        String ctype;        // some simple test for the content type        if (url.endsWith("wav")) {            ctype = "audio/x-wav";        } else if (url.endsWith("jts")) {            ctype = "audio/x-tone-seq";        } else if (url.endsWith("mid")) {            ctype = "audio/midi";        } else {            throw new Exception("Cannot guess content type from URL: " + url);        }        return ctype;    }    private void createPlayer(String url) throws Exception {        if (url.startsWith("resource")) {            int idx = url.indexOf(':');            String loc = url.substring(idx + 1);            InputStream is = getClass().getResourceAsStream(loc);            String ctype = guessContentType(url);            player = Manager.createPlayer(is, ctype);        } else {            player = Manager.createPlayer(url);        }    }    private boolean initPlayer(int bg) {        try {            switch (bg) {            case 1: // wave bg                createPlayer(midlet.wavbgUrl);                break;            case 2: // tone seq bg             {                byte d = 8;                byte C4 = ToneControl.C4;                byte D4 = ToneControl.C4 + 2; // a whole step                byte E4 = ToneControl.C4 + 4; // a major third                byte G4 = ToneControl.C4 + 7; // a fifth                byte rest = ToneControl.SILENCE; // eighth-note rest                byte[] mySequence =                    new byte[] {                        ToneControl.VERSION, 1, ToneControl.TEMPO, 30, ToneControl.BLOCK_START, 0,                        E4, d, D4, d, C4, d, D4, d, E4, d, E4, d, E4, d, rest, d,                        ToneControl.BLOCK_END, 0, ToneControl.PLAY_BLOCK, 0, D4, d, D4, d, D4, d,                        rest, d, E4, d, G4, d, G4, d, rest, d, //play "B" section                        ToneControl.PLAY_BLOCK, 0, // content of "A" section                        D4, d, D4, d, E4, d, D4, d, C4, d, rest, d // play "C" section                    };                player = Manager.createPlayer(Manager.TONE_DEVICE_LOCATOR);                player.realize();                ToneControl c = (ToneControl)player.getControl("ToneControl");                c.setSequence(mySequence);            }            break;            case 3: // MIDI bg                createPlayer(midlet.midbgUrl);                break;            default:                player = null;            }            if (player != null) {                player.setLoopCount(-1);                player.start();            }        } catch (Exception ex) {            ex.printStackTrace();            if (player != null) {                player.close();            }            player = null;            return false;        }        return true;    }    /**     * Draws the drawing frame (which also contains the ball) and the     * controls.     */    protected void paint(Graphics g) {        int x = g.getClipX();        int y = g.getClipY();        int w = g.getClipWidth();        int h = g.getClipHeight();        // Draw the frame         g.setColor(0xffffff);        g.fillRect(x, y, w, h);        // Draw each ball        for (int i = 0; i < numBalls; i++) {            if (balls[i] != null) {                balls[i].paint(g);            }        }        g.setColor(0);        g.drawRect(0, 0, width - 1, height - 1);    }    private void makeNumberOfBalls(int newNum) {        if (balls != null) {            if (newNum > balls.length) {                newNum = balls.length;            } else if (newNum < 1) {                newNum = 1;            }            if (newNum != numBalls) {                // temporarily disable painting                numBalls = 0;                // first create newNum balls, if necessary                for (int i = 0; i < newNum; i++) {                    if (balls[i] == null) {                        balls[i] = new SmallBall(this, 0, 0, width, height);                        balls[i].setNote(notes[i]);                        balls[i].setColor(colors[i]);                    }                    if (!paused && balls[i].stop) {                        balls[i].stop = false;                        (new Thread(balls[i])).start();                    }                }                // then destroy any other balls                for (int i = newNum; i < balls.length; i++) {                    if (balls[i] != null) {                        // stop the thread and remove the reference to it                        balls[i].stop = true;                        balls[i] = null;                    }                }                // enable painting                numBalls = newNum;                if (newNum > 0) {                    balls[0].doRepaint = true;                }            }        }    }    /**     * Destroy     */    synchronized void destroy() {        // kill all the balls and terminate        numBalls = 0;        pause();        balls = null;        if (player != null) {            player.close();            player = null;        }    }    /*     * Return whether the canvas is paused or not.     */    boolean isPaused() {        return paused;    }    /**     * Pause the balls by signaling each of them to stop.     * The ball object still exists and holds the current position     * of the ball.  It may be restarted later.     * the current thread will be terminated.     */    void pause() {        if (!paused) {            synchronized (this) {                paused = true;                for (int i = 0; i < balls.length; i++) {                    if (balls[i] != null) {                        balls[i].stop = true;                    }                }                try {                    if (player != null) {                        player.stop();                    }                } catch (MediaException e) {                    // There's nothing much we can do here.                }            }            repaint();        }    }    /*     * Start creates a new thread for each ball and start it.     */    void start() {        if (paused) {            synchronized (this) {                paused = false;                if (balls != null) {                    for (int i = 0; i < balls.length; i++) {                        if (balls[i] != null) {                            balls[i].stop = false;                            (new Thread(balls[i])).start();                        }                    }                }                if (player != null) {                    try {                        player.start();                    } catch (Exception ex) {                    }                }            }            repaint();        }    }    public void commandAction(Command c, Displayable s) {        if (c == backCommand) {            destroy();            midlet.displayList();        } else if (c == pauseCommand) {            pause();            removeCommand(pauseCommand);            addCommand(playCommand);        } else if (c == playCommand) {            removeCommand(playCommand);            addCommand(pauseCommand);            start();        }    }    /**     * Handle a pen down event.     */    public void keyPressed(int keyCode) {        int action = getGameAction(keyCode);        switch (action) {        case LEFT:            // Reduce the number of threads            makeNumberOfBalls(numBalls - 1);            break;        case RIGHT:            // Increase the number of threads            makeNumberOfBalls(numBalls + 1);            break;        case UP:            // Make them move faster            SmallBall.faster();            break;        case DOWN:            // Make them move slower            SmallBall.slower();            break;        }        repaint();    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费在线看| 成人激情图片网| 国产成人精品亚洲777人妖| 99久久久精品| 日韩丝袜美女视频| 日韩电影在线看| 国产一区二区不卡老阿姨| 在线免费视频一区二区| 精品久久久久一区二区国产| 亚洲色图在线看| 国产一区二区0| 51精品国自产在线| 综合久久久久综合| 成人小视频在线| 日韩欧美中文字幕制服| 亚洲午夜免费视频| 99re成人在线| 国产天堂亚洲国产碰碰| 麻豆精品蜜桃视频网站| 欧美日韩国产高清一区二区三区 | www成人在线观看| 一区二区三区高清在线| 成人av影视在线观看| 久久婷婷久久一区二区三区| 美女网站色91| 欧美一区二区视频在线观看2020| 综合av第一页| 91亚洲精华国产精华精华液| 久久久不卡网国产精品二区| 久久精品国产亚洲a| 欧美欧美欧美欧美首页| 亚洲成人激情av| 欧美日韩黄色一区二区| 亚洲线精品一区二区三区八戒| av一区二区三区黑人| 中文幕一区二区三区久久蜜桃| 精品一区二区免费在线观看| 欧美一卡2卡三卡4卡5免费| 国产成人综合在线观看| 精品成a人在线观看| 久久精品久久久精品美女| 日韩亚洲欧美高清| 国产一级精品在线| 欧美极品xxx| 不卡的看片网站| 中文字幕一区二区5566日韩| 97久久精品人人做人人爽| 综合欧美一区二区三区| 在线观看日韩电影| 日韩国产精品91| 精品福利av导航| 成人一区二区三区在线观看| 综合分类小说区另类春色亚洲小说欧美 | 亚洲国产日产av| 欧美日韩国产天堂| 美国十次综合导航| 国产午夜久久久久| 一本大道久久精品懂色aⅴ| 亚洲va韩国va欧美va| 精品国产欧美一区二区| 国产成人在线视频免费播放| 自拍偷拍亚洲激情| 制服丝袜日韩国产| 国产.精品.日韩.另类.中文.在线.播放| 国产午夜精品久久久久久免费视 | 欧美性一区二区| 另类中文字幕网| 国产精品久久久久久久第一福利 | 色欧美日韩亚洲| 欧美a级理论片| 欧美国产成人在线| 欧美日韩中字一区| 国产精品一区二区黑丝| 亚洲男帅同性gay1069| 51午夜精品国产| 成人激情电影免费在线观看| 亚洲一区二区三区小说| 精品国免费一区二区三区| 一本久久a久久精品亚洲| 久久精品国产99国产精品| 中文字幕中文字幕一区二区| 3751色影院一区二区三区| 成人午夜视频福利| 另类成人小视频在线| 亚洲精品精品亚洲| 久久伊人蜜桃av一区二区| 欧美亚洲动漫另类| 成人免费电影视频| 久久成人免费日本黄色| 一区二区在线观看av| 国产亚洲精品bt天堂精选| 欧美日韩在线免费视频| 成人免费av资源| 九九视频精品免费| 午夜a成v人精品| 最新国产成人在线观看| 久久精品免视看| 日韩精品在线网站| 欧美日本高清视频在线观看| www.成人网.com| 国产一区二区三区免费播放| 日韩精品成人一区二区在线| 亚洲日本va在线观看| 中文子幕无线码一区tr| 久久久久久夜精品精品免费| 欧美一区二区久久久| 欧美视频一区二区三区四区| 99综合电影在线视频| 国产精品18久久久久久久久| 另类欧美日韩国产在线| 日韩电影一区二区三区四区| 亚洲国产精品一区二区久久| 亚洲久草在线视频| 亚洲色图欧美偷拍| 18成人在线观看| 国产精品美女久久久久久久网站| www一区二区| 久久精品网站免费观看| 久久久久久久久一| 国产性色一区二区| 久久综合色8888| 亚洲人成在线播放网站岛国 | 精品一区二区国语对白| 久久精品国产在热久久| 免费成人小视频| 久久99在线观看| 精品一区中文字幕| 国产一区二区三区高清播放| 国产精品原创巨作av| 国产精品66部| av欧美精品.com| 在线观看亚洲精品视频| 欧美日韩免费观看一区二区三区| 欧洲在线/亚洲| 91精品欧美一区二区三区综合在 | 色婷婷久久99综合精品jk白丝| 99久久精品免费| 欧洲激情一区二区| 欧美精品1区2区| 精品国产在天天线2019| 国产午夜精品一区二区三区嫩草| 欧美激情艳妇裸体舞| 亚洲欧美电影一区二区| 亚洲午夜私人影院| 久久99九九99精品| 不卡的看片网站| 欧美日韩在线直播| 欧美tickling挠脚心丨vk| 久久精品视频一区二区三区| 国产精品色哟哟| 亚洲成人7777| 狠狠狠色丁香婷婷综合久久五月| 国产精品99久久久久久久vr| 色综合欧美在线视频区| 欧美一区二区日韩一区二区| 国产日产欧美精品一区二区三区| 亚洲日本电影在线| 免费欧美在线视频| 成人国产精品免费| 在线电影欧美成精品| 久久久www成人免费无遮挡大片| 1000部国产精品成人观看| 日本视频一区二区三区| 粉嫩久久99精品久久久久久夜| 欧美在线视频日韩| 国产日韩在线不卡| 亚洲电影第三页| 成人app软件下载大全免费| 日韩午夜精品电影| 亚洲男女一区二区三区| 精品一区二区三区久久久| 欧美亚日韩国产aⅴ精品中极品| 久久久久久免费| 亚洲sss视频在线视频| 成人av在线播放网站| 欧美成人福利视频| 亚洲小说欧美激情另类| 成人aaaa免费全部观看| 精品国产91久久久久久久妲己| 亚洲综合丝袜美腿| 99久久精品情趣| 久久久久国产精品麻豆 | 国产精品国产三级国产普通话99 | 久久亚洲私人国产精品va媚药| 亚洲一区二区综合| 成人午夜电影网站| 精品日韩一区二区三区免费视频| 亚洲在线视频免费观看| 成人av网站在线观看免费| 日韩美女在线视频| 天堂精品中文字幕在线| 91久久一区二区| 国产精品国产三级国产专播品爱网| 极品瑜伽女神91| 日韩视频一区在线观看| 午夜精品福利一区二区三区av| 91成人网在线| 亚洲黄色av一区| 91首页免费视频| 中文字幕在线播放不卡一区|