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

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

?? photoframe.java

?? J2ME寫的相冊瀏覽程序
?? JAVA
字號:
/* * @(#)PhotoFrame.java	1.4 04/01/27 * * Copyright (c) 2000-2004 Sun Microsystems, Inc. All rights reserved.  * PROPRIETARY/CONFIDENTIAL * Use is subject to license terms */package example.photoalbum;import java.util.Vector;import javax.microedition.lcdui.*;/** * This PhotoFrame provides the picture frame and drives the animation * of the frames and the picture. It handles the starting and stopping * of the Animation and contains the Thread used to do * the timing and requests that the Canvas be repainted * periodically. * It controls the border style and animation speed. */class PhotoFrame extends Canvas implements Runnable {    /** border style */    private int style;    /** animation speed set */    private int speed;    /** Vector of images to display */    private Vector images;    /** Index of next image to display */    private int index;    /** X offset of image in frame */    private int imageX;    /** X offset of image in frame */    private int imageY;    /** Width and height of image */    private int imageWidth, imageHeight;        /** Thread used for triggering repaints */    private Thread thread;    /** buffer image of the screen */    private Image image;    /** Pattern image used for border */    private Image bimage;    /** Time of most recent paint */    private long paintTime;     /** Time of most recent frame rate report */    private long statsTime;    /** Number of frames since last frame rate report */    int frameCount;    /** Last reported frame rate (for re-paint) */    int frameRate;    /**     * Create a new PhotoFrame.     * Create an offscreen mutable image into which the border is drawn.     * Border style is none (0).     * Speed is stopped (0) until set.     */    PhotoFrame() {        image = Image.createImage(getWidth(), getHeight());        setStyle(0);        setSpeed(0);    }        /**     * Set the array of images to be displayed.     * Update the width and height of the image and draw     * the border to fit around it in the offscreen image.     * @param images a vector of images to be displayed.     */    void setImages(Vector images) {        this.images = images;        if (images.size() > 0) {            Image image = (Image)images.elementAt(0);            imageWidth = image.getWidth();            imageHeight = image.getHeight();        } else {            imageWidth = 0;            imageHeight = 0;        }	index = 0;        imageX = (getWidth() - imageWidth) / 2;        imageY = (getHeight() - imageHeight) / 2;        genFrame(style, imageX, imageY, imageWidth, imageHeight);    }    /**     * Advance to the next image and wrap around if necessary.     */    void next() {        if (images == null || ++index >= images.size()) {            index = 0;        }     }    /**     * Back up to the previous image.     * Wrap around to the end if at the beginning.     */    void previous() {        if (images != null && --index < 0) {            index = images.size()-1;        } else {	    index = 0;	}    }     /**     * Reset the PhotoFrame so it holds minimal resources.     * The animation thread is stopped.     */    void reset() {        images = null;        thread = null;    }    /**     * Handle key events. FIRE events toggle between     * running and stopped.  LEFT and RIGHT key events     * when stopped show the previous or next image.     * @param keyCode of the key pressed     */    protected void keyPressed(int keyCode) {        int action = getGameAction(keyCode);        switch (action) {        case RIGHT:	    if (thread == null) {		next();		repaint();	    }            break;        case LEFT:	    if (thread == null) {		previous();		repaint();	    }            break;        case FIRE:            // Use FIRE to toggle the activity of the thread            if (thread == null) {                thread = new Thread(this);                thread.start();            } else {                synchronized (this) {                    // Wake up the thread to change the timing                    this.notify();                }                // Shouldn't be in synchronized block                thread = null;            }            break;        }    }        /**     * Handle key repeat events as regular key events.     * @param keyCode of the key repeated     */    protected void keyRepeated(int keyCode) {        keyPressed(keyCode);    }    /**     * Set the animation speed.     * Speed:     * <OL>     * <LI>0 = stop     * <LI>1 = slow     * <LI>2 = medium     * <LI>3 = fast     * <LI>4 = unlimited     * </OL>     * @param speed speedo of animation 0-3;     */    void setSpeed(int speed) {	this.speed = speed;	statsTime = 0;    }    /**     * Get the speed at which animation occurs.     * @return the current speed.     * @see setSpeed     */    int getSpeed() {        return speed;    }    /**     * Set the frame style.     * Recreate the photo frame image from the current style     * and location and size     * <p>     * Style:     * <OL>     * <LI> Style 0: No border is drawn.     * <LI> Style 1: A simple border is drawn     * <LI> Style 2: The border is outlined and an image     * is created to tile within the border.     * </OL>     * @param style the style of the border; 0 = none, 1 = simple,     * 2 = fancy.     */    void setStyle(int style) {	this.style = style;        genFrame(style, imageX, imageY, imageWidth, imageHeight);    }    /**     * Get the style being used for borders.     * @return the style.     */    int getStyle() {        return style;    }    /**     * Notified when Canvas is made visible.     * If there is more than one image to display     * create the thread to run the animation timing.     */    protected void showNotify() {        if (images != null && images.size() > 1) {            thread = new Thread(this);            thread.start();        }    }    /**     * Notified when the Canvas is no longer visible.     * Signal the running Thread that it should stop.     */    protected void hideNotify() {        thread = null;    }        /**     * Return true if the specified rectangle does not intersect     * the clipping rectangle of the graphics object.  If it returns     * true then the object must be drawn otherwise it would be clipped     * completely.     * The checks are done     * @param g the Graphics context to check.     * @param x the x value of the upper left corner of the rectange     * @param y the y value of the upper left corner of the rectange     * @param w the width of the rectangle     * @param h the height of the rectangle     * @return true if the rectangle intersects the clipping region     */    boolean intersectsClip(Graphics g, int x, int y, int w, int h) {        int cx = g.getClipX();        if (x + w <= cx)            return false;        int cw = g.getClipWidth();        if (x > cx + cw)            return false;        int cy = g.getClipY();        if (y + h <= cy)            return false;        int ch = g.getClipHeight();        if (y > cy + ch)            return false;        return true;    }    /**     * Runs the animation and makes the repaint requests.     * The thread will exit when it is no longer the current     * Animation thread.     */    public void run() {        Thread mythread = Thread.currentThread();        long scheduled = System.currentTimeMillis();	statsTime = scheduled;        paintTime = scheduled;	frameCount = 0;	frameRate = 0;        /*         * The following code was changed to fix bug 4918599.         * The bug is caused by a deadlock caused by         * bad-designed use of synchronized blocks in demo.         */         while (thread == mythread) {                          // Update when the next frame should be drawn             // and compute the delta till then             scheduled += speeds[speed];             long delta = scheduled - paintTime;                          if (delta > 0)  {                 synchronized (this) {                     try {                        this.wait(delta);                     } catch (InterruptedException e) {                     }                 }             }                          // Advance and repaint the screen             next();             repaint();             serviceRepaints();         }    }    /**      * Paint is called whenever the canvas should be redrawn.     * It clears the canvas and draws the frame and the current      * current frame from the animation.     * @param g the Graphics context to which to draw     */    protected void paint(Graphics g) {	paintTime = System.currentTimeMillis();	if (image != null) {	    	    // Draw the frame unless only the picture is being re-drawn	    // This is the inverse of the usual clip check.	    int cx = 0, cy = 0, cw = 0, ch = 0;	    if ((cx = g.getClipX()) < imageX || 		(cy = g.getClipY()) < imageY ||		(cx + (cw = g.getClipWidth())) > (imageX + imageWidth) ||		(cy + (ch = g.getClipHeight())) > (imageY + imageHeight)) {		g.drawImage(image, 0, 0, Graphics.LEFT|Graphics.TOP);		if (frameRate > 0) {		    g.fillRect(0, getHeight(), 60, 20);		    g.drawString("FPS = " + frameRate, 0, getHeight(), 				 Graphics.BOTTOM|Graphics.LEFT);		}	    }	    // Draw the image if it intersects the clipping region	    if (images != null &&		index < images.size() &&		intersectsClip(g, imageX, imageY, imageWidth, imageHeight)) {		g.drawImage((Image)images.elementAt(index),			    imageX, imageY, Graphics.LEFT|Graphics.TOP);	    }	    frameCount++;	    // Update Frame rate	    int delta = (int)(paintTime - statsTime);	    if (delta > 1000 && delta < 10000) {		frameRate = ((frameCount * 1000 + 500) / delta);		frameCount = 0;		statsTime = paintTime;		repaint();	// queue full repaint to display frame rate	    }	}    }        /**     * Paint the photo frame into the buffered screen image.     * This will avoid drawing each of its parts on each repaint.     * Paint will only need to put the image into the frame.     * @param style the style of frame to draw.     * @param x the x offset of the image.     * @param y the y offset of the image     * @param width the width of the anmiation image     * @param height the height of the animation image     */    private void genFrame(int style, int x, int y, int width, int height) {        Graphics g = image.getGraphics();        // Clear the entire image to white        g.setColor(0xffffff);        g.fillRect(0, 0, image.getWidth()+1, image.getHeight()+1);                // Set the origin of the image and paint the border and image.        g.translate(x, y);        paintBorder(g, style, width, height);    }    /**     * Draw a border of the selected style.     * @param g graphics context to which to draw.     * @param style of the border to display     * @param w the width reserved for the image     * @param h the height reserved of the image     * @see setStyle     */    private void paintBorder(Graphics g, int style, int w, int h) {	if (style == 1) {	    g.setGrayScale(128);	    g.drawRect(-1, -1, w + 1, h + 1);	    g.drawRect(-2, -2, w + 3, h + 3);	}	if (style == 2) {            // Draw fancy border with image between outer and inner rectangles            if (bimage == null)                 bimage = genBorder();          // Generate the border image	    int bw = bimage.getWidth();	    int bh = bimage.getHeight();	    int i;            // Draw the inner and outer solid border	    g.setGrayScale(128);	    g.drawRect(-1, -1, w + 1, h + 1);	    g.drawRect(-bw - 2, -bh - 2, w + bw * 2 + 3, h + bh * 2 + 3);            // Draw it in each corner            g.drawImage(bimage, -1, -1, Graphics.BOTTOM|Graphics.RIGHT); 	    g.drawImage(bimage, -1, h + 1, Graphics.TOP|Graphics.RIGHT);	    g.drawImage(bimage, w + 1, -1, Graphics.BOTTOM|Graphics.LEFT);	    g.drawImage(bimage, w + 1, h + 1, Graphics.TOP|Graphics.LEFT);            // Draw the embedded image down left and right sides            for (i = ((h % bh) / 2); i < h - bh; i += bh) {		g.drawImage(bimage, -1, i, Graphics.RIGHT|Graphics.TOP);		g.drawImage(bimage, w + 1, i, Graphics.LEFT|Graphics.TOP);	    }            // Draw the embedded image across the top and bottom	    for (i = ((w % bw) / 2); i < w - bw; i += bw) {		g.drawImage(bimage, i, -1, Graphics.LEFT|Graphics.BOTTOM);		g.drawImage(bimage, i, h + 1, Graphics.LEFT|Graphics.TOP);	    }	}    }    /**     * Create an image for the border.     * The border consists of a simple "+" drawn in a 5x5 image.     * Fill the image with white and draw the "+" as magenta.     * @return the image initialized with the pattern     */    private Image genBorder() {        Image image = Image.createImage(5, 5);        Graphics g = image.getGraphics();        g.setColor(255, 255, 255);        g.fillRect(0, 0, 5, 5);        g.setColor(128, 0, 255);        g.drawLine(2, 1, 2, 3); // vertical        g.drawLine(1, 2, 3, 2); // horizontal        return image;    }    /**     * Mapping of speed values to delays in ms.     * Indices map to those in the speed ChoiceGroup in the options form.     * The indices are: 0 = stop, 1 = slow, 2 = medium, 3 = fast.     * @see setSpeed     */    private final static int speeds[] = {999999999, 500, 250, 100, 0};}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区三区自拍| 六月婷婷色综合| 肉色丝袜一区二区| 国产精品综合av一区二区国产馆| 成人免费视频一区| 91精品国产综合久久小美女| 国产精品免费视频一区| 日本不卡高清视频| 在线观看中文字幕不卡| 欧美精品一区二区三区蜜臀| 亚洲一区二区三区美女| 国产成人av一区二区三区在线观看| 欧美色图第一页| 中文字幕免费不卡| 久久99久久99| 欧美一卡二卡在线观看| 一区二区久久久久久| 国产成人精品免费| 久久综合九色综合久久久精品综合| 亚洲综合999| 91色视频在线| 中文字幕精品—区二区四季| 捆绑调教一区二区三区| 欧美日精品一区视频| 国产精品激情偷乱一区二区∴| 精品一二三四在线| 日韩一级完整毛片| 日韩电影在线一区二区| 欧美综合一区二区| 一区二区三区视频在线看| 大白屁股一区二区视频| 国产性色一区二区| 国产传媒一区在线| 精品久久久久久久久久久久久久久| 亚洲主播在线播放| 欧美在线啊v一区| 一区二区在线电影| 色悠悠久久综合| 亚洲欧美精品午睡沙发| 色悠久久久久综合欧美99| 一区二区三区日韩精品| 在线观看区一区二| 成人午夜精品一区二区三区| 久久久精品免费网站| 亚洲成人自拍偷拍| 91麻豆精品视频| 一区二区三区四区激情| 一本久道久久综合中文字幕| 亚洲久本草在线中文字幕| 91福利精品视频| 亚洲成人一二三| 在线成人免费观看| 久久精品国产澳门| 精品国产三级a在线观看| 国产一本一道久久香蕉| 久久久99免费| 99精品国产91久久久久久| 亚洲老妇xxxxxx| 欧美性受xxxx| 青青草国产成人99久久| 久久一夜天堂av一区二区三区| 国产成人精品一区二区三区四区| 亚洲国产高清不卡| 欧美日韩中字一区| 韩国在线一区二区| 国产精品国产成人国产三级| 91丨porny丨蝌蚪视频| 午夜欧美2019年伦理| 欧美成人性战久久| heyzo一本久久综合| 一区二区三区电影在线播| 日韩一区二区三区在线视频| 国产成人亚洲综合色影视| 亚洲精品写真福利| 欧美成人福利视频| 97久久精品人人做人人爽| 青青草成人在线观看| 欧美国产精品中文字幕| 在线国产亚洲欧美| 国产一本一道久久香蕉| 一区二区三区精品视频在线| 亚洲精品一区二区三区影院 | 精品写真视频在线观看| 中文字幕亚洲不卡| 日韩精品一区二区三区在线 | 美国av一区二区| 亚洲欧美另类久久久精品| 精品免费国产一区二区三区四区| 91久久精品网| 国产成人在线视频免费播放| 日韩高清中文字幕一区| 综合久久给合久久狠狠狠97色| 制服丝袜中文字幕亚洲| 91性感美女视频| 狠狠狠色丁香婷婷综合激情| 亚洲国产精品视频| 欧美激情艳妇裸体舞| 制服丝袜av成人在线看| 色婷婷久久99综合精品jk白丝| 精东粉嫩av免费一区二区三区| 亚洲一区二区三区四区五区黄| 国产精品欧美一区喷水| 精品国产一区二区三区忘忧草 | 美女脱光内衣内裤视频久久网站 | 成人午夜视频在线| 九九精品视频在线看| 日韩成人免费看| 亚洲午夜激情网页| 樱花影视一区二区| 国产精品嫩草影院com| 精品99999| 久久免费午夜影院| 欧美va亚洲va在线观看蝴蝶网| 欧美日本精品一区二区三区| 91视频观看视频| av在线这里只有精品| 成人18视频日本| 成人avav在线| 93久久精品日日躁夜夜躁欧美| 国产aⅴ综合色| 成人综合婷婷国产精品久久免费| 紧缚捆绑精品一区二区| 精品一区二区免费视频| 久久精品国产久精国产爱| 日韩一区欧美二区| 视频在线观看一区| 青椒成人免费视频| 久久精品国产77777蜜臀| 久久国产精品露脸对白| 激情国产一区二区| 国产成人亚洲综合a∨婷婷图片| 国产一区二区福利| 国产不卡视频在线观看| 97精品电影院| 欧美亚洲动漫精品| 欧美一区二区视频在线观看2022| 69p69国产精品| 欧美大肚乱孕交hd孕妇| 久久精品视频免费| 中文字幕一区二区三区乱码在线| 亚洲欧美激情小说另类| 亚洲.国产.中文慕字在线| 视频一区二区国产| 国产一区在线精品| 不卡视频在线观看| 在线看国产一区| 日韩视频免费观看高清在线视频| 精品卡一卡二卡三卡四在线| 国产精品网站在线| 亚洲最大成人网4388xx| 看电视剧不卡顿的网站| 风间由美一区二区av101 | 狠狠色丁香婷综合久久| 丰满放荡岳乱妇91ww| 欧洲日韩一区二区三区| 日韩一级大片在线| 中文字幕亚洲区| 日本中文字幕一区二区视频| 国产成人在线免费观看| 欧美三级日韩在线| 欧美大片在线观看一区| 亚洲精品中文字幕乱码三区| 日本不卡123| 一本大道av伊人久久综合| 欧美一区二区三区免费大片 | 日韩亚洲欧美在线观看| 国产欧美精品日韩区二区麻豆天美| 亚洲精品久久久蜜桃| 国产精品中文字幕欧美| 欧美性猛交一区二区三区精品 | 免费在线观看视频一区| 不卡的电影网站| 精品日韩欧美一区二区| 一区二区三区小说| 国产精品 日产精品 欧美精品| 欧美日韩精品一区二区天天拍小说| 久久久久99精品国产片| 无码av中文一区二区三区桃花岛| 国产91丝袜在线播放0| 欧美一区二区三区免费在线看| 亚洲人成网站在线| 福利一区二区在线| 欧美精品一区二区三区视频| 亚洲国产另类av| 99久久伊人精品| 欧美xxxx老人做受| 日韩精品一二区| 欧美怡红院视频| 亚洲人成小说网站色在线 | 亚洲精品一区二区在线观看| 五月天欧美精品| 欧美日韩成人一区二区| 亚洲女人****多毛耸耸8| 成人丝袜18视频在线观看| 久久综合成人精品亚洲另类欧美| 日欧美一区二区| 欧美日韩高清在线播放| 亚洲一区二区五区| 欧美日韩在线三区| 久久99久久99|