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

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? bouncingtextcanvas.java

?? J2ME MIDP_Example_Applications
?? JAVA
字號(hào):
// Copyright 2002 Nokia Corporation.//// THIS SOURCE CODE IS PROVIDED 'AS IS', WITH NO WARRANTIES WHATSOEVER,// EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY, FITNESS// FOR ANY PARTICULAR PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE// OR TRADE PRACTICE, RELATING TO THE SOURCE CODE OR ANY WARRANTY OTHERWISE// ARISING OUT OF ANY PROPOSAL, SPECIFICATION, OR SAMPLE AND WITH NO// OBLIGATION OF NOKIA TO PROVIDE THE LICENSEE WITH ANY MAINTENANCE OR// SUPPORT. FURTHERMORE, NOKIA MAKES NO WARRANTY THAT EXERCISE OF THE// RIGHTS GRANTED HEREUNDER DOES NOT INFRINGE OR MAY NOT CAUSE INFRINGEMENT// OF ANY PATENT OR OTHER INTELLECTUAL PROPERTY RIGHTS OWNED OR CONTROLLED// BY THIRD PARTIES//// Furthermore, information provided in this source code is preliminary,// and may be changed substantially prior to final release. Nokia Corporation// retains the right to make changes to this source code at// any time, without notice. This source code is provided for informational// purposes only.//// Nokia and Nokia Connecting People are registered trademarks of Nokia// Corporation.// Java and all Java-based marks are trademarks or registered trademarks of// Sun Microsystems, Inc.// Other product and company names mentioned herein may be trademarks or// trade names of their respective owners.//// A non-exclusive, non-transferable, worldwide, limited license is hereby// granted to the Licensee to download, print, reproduce and modify the// source code. The licensee has the right to market, sell, distribute and// make available the source code in original or modified form only when// incorporated into the programs developed by the Licensee. No other// license, express or implied, by estoppel or otherwise, to any other// intellectual property rights is granted herein.package example.hello;import java.util.Random;import javax.microedition.lcdui.*;class BouncingTextCanvas    extends Canvas    implements CommandListener, Runnable{    private static final int MILLIS_PER_TICK = 200; // msec    private final BouncingTextMIDlet midlet; // parent MIDlet    private final Display display;           // parent MIDlet's Display    private final Command exitCommand;       // display 'Exit' command    private final Command reverseCommand;    // display 'Reverse' command    private final BouncingText text;         // text string to print    private int bgRGB;                       // background color    private int textRGB;                     // text color    private volatile Thread animationThread = null; // animation thread    BouncingTextCanvas(BouncingTextMIDlet midlet, Display display,                       String string)    {        this.midlet  = midlet;        this.display = display;        // Setup the command handling        setCommandListener(this);        reverseCommand = new Command("Rev", Command.SCREEN, 1);        exitCommand = new Command("Exit", Command.EXIT, 1);        addCommand(exitCommand);        addCommand(reverseCommand);        // Initialize the bouncing text message        //        // Create a new 'bouncing text' string whose color is 'textRGB'.        // Its initial position is at x=0 and        // y="middle of the canvas". the canvas width and height        // are also used by a BouncingText object, as it manages        // its own position update within the canvas displayable area        // {x,y} = {0,0} to {w,h}.        int ch = getHeight(); // canvas height        int cw = getWidth();  // canvas width        initColors();         // Choose fg and background colors ...                              // ... based on display capabilities.        text = new BouncingText(string, textRGB, 0, ch/2, cw, ch);    }    synchronized void startAnimation()    {        animationThread = new Thread(this);        animationThread.start();    }    synchronized void stopAnimation()    {        animationThread = null;    }    // While this thread has not been stopped, it will perform a    // tick() action approximately every 'millis_per_tick' milliseconds    // (as close to that period as possible).    public void run()    {        Thread currentThread = Thread.currentThread();        try        {            // This ends when animationThread is set to null, or when            // it is subsequently set to a new Thread.  Either way, the            // current thread should terminate.            while (currentThread == animationThread)            {                long startTime = System.currentTimeMillis();                if (isShown())                {                    // If the canvas is not visible, it may be hidden                    // by a system screen (for example, a display screen for                    // an incoming phone call, etc.). We don't move the                    // bouncing text, nor repaint the canvas unless we are                    // visible (e.g. an obscuring system screen goes away).                    tick();                    repaint(0, 0, getWidth(), getHeight());                    serviceRepaints();                }                long elapsedTime = System.currentTimeMillis() - startTime;                if (elapsedTime < MILLIS_PER_TICK)                {                    synchronized(this)                    {                        wait(MILLIS_PER_TICK - elapsedTime);                    }                }                else                {                    currentThread.yield();                }            }        }        catch(InterruptedException e)        {        }    }    //Draw the background and the bouncing text string    public void paint(Graphics g)    {        g.setColor(bgRGB);        g.fillRect(0, 0, getWidth(), getHeight());        text.draw(g);    }    // Handle the UI commands    public void commandAction(Command c, Displayable d)    {        if (c == exitCommand)        {            stopAnimation();            midlet.exitRequested();        }        else if (c == reverseCommand)        {            text.reverse();        }    }    // What to do each run() tick    private synchronized void tick()    {        text.updatePosition();    }    // Choose a random background color on color displays,    // use a white background color on black-and-white displays    private void initColors()    {        int white = 0xffffff;        int black = 0x000000;        if (display.isColor())        {            Random random = new Random();            textRGB = random.nextInt() & 0xffffff;            bgRGB = white - textRGB; // constrasting background color        }        else        {            textRGB = black;            bgRGB = white;        }    }    class BouncingText    {        private final int w;          // The canvas width        private final int h;          // The canvas height        private final int textRGB;    // Color for the string        private final Random random;  // For generating random numbers        private String string;        // The string to print        private int x;                // The x anchor for the string        private int y;                // The y anchor for the string        private int strWidth = 0;     // The pixel width of the string        private int strHeight = 0;    // The pixel height of the string        private int xdir = 1;         // 1 or -1 : bounce direction        private int ydir = 1;         // 1 or -1 : bounce direction        BouncingText(String string, int textRGB,                     int x, int y, int w, int h)        {            this.string = string;            this.x = x;            this.y = y;            this.w = w;            this.h = h;            this.textRGB = textRGB;            random = new Random();        }        // Randomly change the position of the string, the string        // must be completely drawable within the canvas        private void updatePosition()        {            // Choose a random { vx, vy } velocity.            int vx = random.nextInt() & 0x07;  // 0-7 pixels            int vy = random.nextInt() & 0x07;  // 0-7 pixels            // Note: The methods maxAnchorX() and maxAnchorY()            //       determine the upper left hand {x, y} coordinates            //       of the string so that the string can be drawn            //       within the canvas height and width.            if ((xdir == 1) && ((x + vx) >= maxAnchorX()))            {                xdir = -xdir;  // change direction at right edge            }            else if ((xdir == -1) && ((x - vx) < 0))            {                xdir = -xdir;  // change direction at left edge            }            int xnew = x + (vx * xdir) ;            if ((xnew >= 0) && (x < maxAnchorX()))            {                x = xnew;            }            if ((ydir == 1) && ((y + vy) >= maxAnchorY()))            {                ydir = -ydir;  // change direction at bottom edge            }            else if ((ydir == -1) && ((y - vy) < 0))            {                ydir = -ydir;  // change direction at top edge            }            int ynew = y + (vy * ydir) ;            if ((ynew >= 0) && (y < maxAnchorY()))            {                y = ynew;            }        }        // Draw the text string at the appropriate position        private void draw(Graphics g)        {             // If the strHeight is still 0, then initialize the             // strHeight and strWidth variables used in maxAnchorX()             // and maxAnchorY(). This assumes that the font represents             // strings as at least 1 pixel high.             if (! (strHeight > 0))             {                 Font f = g.getFont();                 strHeight = f.getHeight();                 strWidth = f.stringWidth(string);             }             // draw the string             g.setColor(textRGB);             g.drawString(string, x, y, Graphics.TOP|Graphics.LEFT);        }        private int maxAnchorX()        {            return w - strWidth;        }        private int maxAnchorY()        {            return h - strHeight;        }        // Reverse the BouncingText string        private void reverse()        {            // Note: another approach is to store two copies of            //       the string, one forwards and one reversed            char[] carray = string.toCharArray();            for (int old = string.length()-1, nu=0;                 old >=0;                 old--, nu++)            {               carray[nu] = string.charAt(old);            }            string = new String(carray);        }    }}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人一级片网址| 亚洲精品免费一二三区| 国产精品久99| 午夜在线成人av| 国内成人免费视频| 91福利小视频| 精品国产乱子伦一区| 国产精品久久综合| 免费在线看成人av| 99久久久国产精品免费蜜臀| 6080亚洲精品一区二区| 国产精品久久久久aaaa| 秋霞成人午夜伦在线观看| 成人av电影在线网| 制服丝袜成人动漫| 国产精品久久久久久久午夜片| 丝袜亚洲另类欧美综合| 成人99免费视频| 日韩一级完整毛片| 洋洋成人永久网站入口| 国产精品自拍一区| 欧美在线免费视屏| 国产精品美女一区二区三区 | av毛片久久久久**hd| 欧美日韩精品一区二区天天拍小说 | 欧美理论在线播放| 国产欧美视频一区二区三区| 婷婷六月综合网| 99视频超级精品| 精品成人免费观看| 亚洲成在人线免费| av激情成人网| 久久亚洲综合色| 视频在线在亚洲| 91丨九色porny丨蝌蚪| 精品国产第一区二区三区观看体验| 亚洲一区二区三区影院| 成人午夜私人影院| 久久免费视频一区| 蜜臀av一区二区在线免费观看| 91久久精品一区二区三| 国产精品青草久久| 国产一区二区精品在线观看| 欧美一级视频精品观看| 亚洲国产裸拍裸体视频在线观看乱了| 成人av在线网| 欧美激情一二三区| 欧美日韩三级一区二区| 国产精品白丝在线| 国产成人综合在线播放| 日韩欧美成人激情| 日本不卡一区二区| 欧美日韩成人高清| 一区二区高清在线| 91啪九色porn原创视频在线观看| 亚洲国产精品成人综合色在线婷婷| 久久se精品一区二区| 337p亚洲精品色噜噜噜| 亚洲国产精品一区二区久久 | 亚洲午夜电影在线观看| 91视频在线看| 最新热久久免费视频| av在线这里只有精品| 中文一区在线播放| 99视频在线精品| 亚洲欧美日韩国产手机在线 | 亚洲色图丝袜美腿| 成人深夜在线观看| 国产精品三级电影| aaa亚洲精品一二三区| ...中文天堂在线一区| 91无套直看片红桃| 亚洲精品一卡二卡| 在线视频中文字幕一区二区| 亚洲一区二区三区免费视频| 在线观看日韩电影| 丝袜亚洲精品中文字幕一区| 欧美一级久久久| 精品制服美女久久| 久久麻豆一区二区| 99久久精品国产麻豆演员表| 国产一区二区三区久久久| 亚洲欧洲国产日本综合| 欧美在线免费播放| aa级大片欧美| 欧美精品777| gogogo免费视频观看亚洲一| 九色porny丨国产精品| 自拍偷拍欧美精品| 国产欧美一区二区精品婷婷| 亚洲综合999| 欧美日韩国产高清一区二区三区 | av电影在线观看一区| 日韩一区中文字幕| 日本高清无吗v一区| 亚洲一区二区精品视频| 777久久久精品| 国产精品一区二区不卡| 亚洲视频免费在线观看| 欧美影视一区二区三区| 日韩电影一区二区三区| 久久久.com| 91网站最新地址| 亚洲成av人影院在线观看网| 日韩精品影音先锋| 成人精品视频.| 亚洲午夜精品一区二区三区他趣| 欧美一区二区啪啪| 国产69精品久久久久777| 亚洲欧美日韩国产综合在线| 欧美丰满一区二区免费视频| 精品一区二区影视| 亚洲色图丝袜美腿| 日韩欧美中文字幕精品| jlzzjlzz亚洲女人18| 亚洲va韩国va欧美va精品 | 国产一区激情在线| 自拍偷在线精品自拍偷无码专区 | 激情深爱一区二区| 亚洲美女免费视频| 精品国产91九色蝌蚪| 91玉足脚交白嫩脚丫在线播放| 视频一区二区中文字幕| 久久色中文字幕| 欧美三级乱人伦电影| 国产乱淫av一区二区三区| 亚洲综合图片区| 国产女主播在线一区二区| 欧美日韩国产综合草草| 成人三级伦理片| 麻豆精品视频在线观看视频| 亚洲品质自拍视频网站| 精品国产一区二区国模嫣然| 色妹子一区二区| 国产乱码精品1区2区3区| 亚洲国产精品久久久男人的天堂| 欧美激情艳妇裸体舞| 91精品黄色片免费大全| 91蜜桃视频在线| 国产精品亚洲午夜一区二区三区 | 欧美大片在线观看| 91福利国产成人精品照片| 国产自产视频一区二区三区| 亚洲一区二区三区四区在线免费观看 | 国产精品三级av| 日韩精品一区二区三区swag| 欧美色欧美亚洲另类二区| 成人国产视频在线观看| 精品亚洲成a人| 日本视频在线一区| 亚洲成人av电影在线| 亚洲欧洲精品天堂一级| 久久久久久久久99精品| 欧美一区二区三区免费在线看| 日本韩国精品在线| 91在线精品一区二区| 成人国产精品免费观看| 韩国一区二区视频| 久久激情综合网| 秋霞电影网一区二区| 亚洲h在线观看| 亚洲欧洲制服丝袜| 亚洲欧洲国产日韩| 国产精品超碰97尤物18| 国产欧美一区二区三区网站| 亚洲精品一区在线观看| 欧美一级专区免费大片| 在线不卡免费欧美| 色香蕉久久蜜桃| 色av一区二区| 在线视频综合导航| 色视频一区二区| 在线观看亚洲一区| 欧美三级午夜理伦三级中视频| 91搞黄在线观看| 在线观看国产日韩| 色哟哟一区二区| 色av成人天堂桃色av| 在线观看日韩电影| 欧美色综合天天久久综合精品| 欧美体内she精高潮| 欧美三级电影网| 欧美精品v日韩精品v韩国精品v| 欧美三级日韩三级| 91精品蜜臀在线一区尤物| 欧美一区二视频| 日韩久久久久久| 欧美精品一区二区三区很污很色的| 欧美成人激情免费网| 337p粉嫩大胆噜噜噜噜噜91av| 久久综合久久99| 中文字幕欧美日本乱码一线二线| 国产精品久久久久影院老司 | 精品视频在线免费观看| 3d动漫精品啪啪1区2区免费 | 国产不卡一区视频| 播五月开心婷婷综合| 色综合久久66| 欧美日韩精品欧美日韩精品一| 欧美一区二区久久久|