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

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

?? swtresourcemanager.java

?? Eclipse開發(fā)入門與項目實踐+源代碼,是郵電出版社書籍配套源碼
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
package com.swtdesigner;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;

/**
 * Utility class for managing OS resources associated with SWT controls such as
 * colors, fonts, images, etc.
 * 
 * !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code>
 * method to release the operating system resources managed by cached objects
 * when those objects and OS resources are no longer needed (e.g. on
 * application shutdown)
 * 
 * This class may be freely distributed as part of any application or plugin.
 * <p>
 * Copyright (c) 2003 - 2005, Instantiations, Inc. <br>All Rights Reserved
 * 
 * @author scheglov_ke
 * @author Dan Rubel
 */
public class SWTResourceManager {

    /**
     * Dispose of cached objects and their underlying OS resources. This should
     * only be called when the cached objects are no longer needed (e.g. on
     * application shutdown)
     */
    public static void dispose() {
        disposeColors();
        disposeFonts();
        disposeImages();
        disposeCursors();
    }

    //////////////////////////////
    // Color support
    //////////////////////////////

    /**
     * Maps RGB values to colors
     */
    private static HashMap m_ColorMap = new HashMap();

    /**
     * Returns the system color matching the specific ID
     * @param systemColorID int The ID value for the color
     * @return Color The system color matching the specific ID
     */
    public static Color getColor(int systemColorID) {
        Display display = Display.getCurrent();
        return display.getSystemColor(systemColorID);
    }

    /**
     * Returns a color given its red, green and blue component values
     * @param r int The red component of the color
     * @param g int The green component of the color
     * @param b int The blue component of the color
     * @return Color The color matching the given red, green and blue componet values
     */
    public static Color getColor(int r, int g, int b) {
        return getColor(new RGB(r, g, b));
    }

    /**
     * Returns a color given its RGB value
     * @param rgb RGB The RGB value of the color
     * @return Color The color matching the RGB value
     */
    public static Color getColor(RGB rgb) {
        Color color = (Color) m_ColorMap.get(rgb);
        if (color == null) {
            Display display = Display.getCurrent();
            color = new Color(display, rgb);
            m_ColorMap.put(rgb, color);
        }
        return color;
    }

    /**
     * Dispose of all the cached colors
     */
    public static void disposeColors() {
        for (Iterator iter = m_ColorMap.values().iterator(); iter.hasNext();)
             ((Color) iter.next()).dispose();
        m_ColorMap.clear();
    }

    //////////////////////////////
    // Image support
    //////////////////////////////

	/**
	 * Maps image names to images
	 */
    private static HashMap m_ClassImageMap = new HashMap();

	/**
	 * Maps images to image decorators
	 */
    private static HashMap m_ImageToDecoratorMap = new HashMap();

    /**
     * Returns an image encoded by the specified input stream
     * @param is InputStream The input stream encoding the image data
     * @return Image The image encoded by the specified input stream
     */
    protected static Image getImage(InputStream is) {
        Display display = Display.getCurrent();
        ImageData data = new ImageData(is);
        if (data.transparentPixel > 0)
            return new Image(display, data, data.getTransparencyMask());
        return new Image(display, data);
    }

    /**
     * Returns an image stored in the file at the specified path
     * @param path String The path to the image file
     * @return Image The image stored in the file at the specified path
     */
    public static Image getImage(String path) {
    	return getImage("default", path);
    }

    /**
     * Returns an image stored in the file at the specified path
     * @param section The section to which belongs specified image
     * @param path String The path to the image file
     * @return Image The image stored in the file at the specified path
     */
    public static Image getImage(String section, String path) {
        String key = section + "|" + SWTResourceManager.class.getName() + "|" + path;
        Image image = (Image) m_ClassImageMap.get(key);
        if (image == null) {
            try {
                FileInputStream fis = new FileInputStream(path);
                image = getImage(fis);
                m_ClassImageMap.put(key, image);
                fis.close();
            } catch (Exception e) {
            	image = getMissingImage();
            	m_ClassImageMap.put(key, image);
            }
        }
        return image;
    }

    /**
     * Returns an image stored in the file at the specified path relative to the specified class
     * @param clazz Class The class relative to which to find the image
     * @param path String The path to the image file
     * @return Image The image stored in the file at the specified path
     */
    public static Image getImage(Class clazz, String path) {
        String key = clazz.getName() + "|" + path;
        Image image = (Image) m_ClassImageMap.get(key);
        if (image == null) {
        	try {
        		if (path.length() > 0 && path.charAt(0) == '/') {
        			String newPath = path.substring(1, path.length());
        			image = getImage(new BufferedInputStream(clazz.getClassLoader().getResourceAsStream(newPath)));
        		} else {
        			image = getImage(clazz.getResourceAsStream(path));
        		}
        		m_ClassImageMap.put(key, image);
        	} catch (Exception e) {
        		image = getMissingImage();
        		m_ClassImageMap.put(key, image);
        	}
        }
        return image;
    }

    private static final int MISSING_IMAGE_SIZE = 10;
	private static Image getMissingImage() {
		Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
		//
		GC gc = new GC(image);
		gc.setBackground(getColor(SWT.COLOR_RED));
		gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
		gc.dispose();
		//
		return image;
	}

    /**
     * Style constant for placing decorator image in top left corner of base image.
     */
    public static final int TOP_LEFT = 1;
    /**
     * Style constant for placing decorator image in top right corner of base image.
     */
    public static final int TOP_RIGHT = 2;
    /**
     * Style constant for placing decorator image in bottom left corner of base image.
     */
    public static final int BOTTOM_LEFT = 3;
    /**
     * Style constant for placing decorator image in bottom right corner of base image.
     */
    public static final int BOTTOM_RIGHT = 4;
    
    /**
     * Returns an image composed of a base image decorated by another image
     * @param baseImage Image The base image that should be decorated
     * @param decorator Image The image to decorate the base image
     * @return Image The resulting decorated image
     */
    public static Image decorateImage(Image baseImage, Image decorator) {
    	return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
    }
    
    /**
	 * Returns an image composed of a base image decorated by another image

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲高清在线精品| 亚洲精品第1页| 国产成人亚洲精品青草天美| 国产精品久久久久久久岛一牛影视| 91麻豆免费在线观看| 亚洲妇熟xx妇色黄| 欧美大片国产精品| 色综合久久综合| 久久se这里有精品| 一区二区三区四区国产精品| 91精品国产一区二区三区 | 日本中文字幕一区二区有限公司| 国产亚洲污的网站| 91在线观看高清| 男女激情视频一区| 亚洲乱码国产乱码精品精可以看| 日韩一区二区三区在线观看| 91福利国产精品| 国产成人在线视频网址| 丝袜亚洲精品中文字幕一区| 一区二区三区精品在线| 国产人久久人人人人爽| 精品国产凹凸成av人导航| 在线看国产一区二区| 国产99久久久精品| 国产精品一区二区x88av| 五月激情综合网| 一区二区三区四区av| 国产清纯白嫩初高生在线观看91| 精品一区二区三区的国产在线播放| 亚洲一区二区三区视频在线播放| 国产精品久久三| 中文字幕不卡的av| 欧美精品一区二区三区蜜桃视频| 欧美私人免费视频| 91年精品国产| 成年人午夜久久久| 视频一区国产视频| 欧美日韩国产色站一区二区三区| 日韩av电影免费观看高清完整版 | 日韩一区二区三区免费看| 亚洲综合激情另类小说区| 制服丝袜国产精品| 精品一区二区国语对白| 精品欧美乱码久久久久久| 91福利视频网站| 另类小说综合欧美亚洲| 欧美色区777第一页| 久久精品一区二区三区av| 亚洲福中文字幕伊人影院| 日韩精品一区二区三区四区| 国产欧美精品一区aⅴ影院 | 久久久亚洲精品石原莉奈| 欧美浪妇xxxx高跟鞋交| 在线免费观看不卡av| 欧美亚洲精品一区| 欧美私模裸体表演在线观看| 欧美性猛交xxxxxx富婆| 欧美日韩精品三区| 91最新地址在线播放| 紧缚捆绑精品一区二区| 亚洲一区在线观看视频| 一区二区三区在线视频免费观看| 91精品国产综合久久久久久漫画| 精品无人码麻豆乱码1区2区| 亚洲色图在线播放| 欧美变态口味重另类| 777a∨成人精品桃花网| 国产日韩影视精品| 青青青伊人色综合久久| 在线观看视频一区| 中文字幕一区二区三区在线不卡 | 欧美亚洲尤物久久| 亚洲视频在线一区二区| 一区二区三区.www| 成人免费va视频| 色综合久久综合网| 日韩欧美国产一区二区在线播放| 中文字幕的久久| 国产麻豆一精品一av一免费| 91色乱码一区二区三区| 久久网站最新地址| 久久aⅴ国产欧美74aaa| 7777精品伊人久久久大香线蕉完整版 | 欧美成人女星排名| 亚洲欧美成aⅴ人在线观看| av高清不卡在线| 国产精品久久久久精k8 | 99精品一区二区| 1区2区3区欧美| 91小视频在线免费看| 亚洲色图丝袜美腿| 日本高清不卡在线观看| 一区二区三区国产精品| 欧美日韩精品欧美日韩精品一 | 欧美日本韩国一区| 日韩高清不卡一区二区三区| 日韩亚洲欧美成人一区| 国产白丝网站精品污在线入口| 国产精品国产三级国产| 91在线播放网址| 精品精品欲导航| 国产精品美女一区二区| 久久爱另类一区二区小说| av一本久道久久综合久久鬼色| 91国偷自产一区二区使用方法| 亚洲私人黄色宅男| 国产一区二区看久久| 粉嫩高潮美女一区二区三区| 色婷婷av一区二区三区大白胸| 久久品道一品道久久精品| 丝袜诱惑亚洲看片 | 高清不卡在线观看av| 日韩一级黄色大片| 亚洲成人久久影院| 在线一区二区三区做爰视频网站| 国产精品久久久久久亚洲毛片 | 色综合中文字幕| 国产精品你懂的在线| 国产一区视频在线看| 日韩免费看的电影| 亚洲成av人综合在线观看| 欧洲av在线精品| 一区二区三区在线高清| 99国产精品久久久久久久久久久 | 欧美色图一区二区三区| 国产精品视频看| 国内精品自线一区二区三区视频| 日韩欧美亚洲国产另类 | 欧美午夜免费电影| 一区二区三区在线观看视频 | 2021中文字幕一区亚洲| 日本va欧美va精品发布| 欧美一级在线观看| 美腿丝袜亚洲一区| 日韩欧美aaaaaa| 精品亚洲成av人在线观看| 精品日本一线二线三线不卡| 国内一区二区视频| 国产日韩精品一区二区浪潮av| 丁香婷婷综合网| 国产精品高潮久久久久无| 91免费版pro下载短视频| 亚洲免费观看高清| 欧美日韩亚洲综合在线 | 国产精品亲子伦对白| 99久久综合国产精品| 一区二区三区在线观看网站| 欧美三区免费完整视频在线观看| 午夜av区久久| 欧美xxxxx裸体时装秀| 国产jizzjizz一区二区| 亚洲色大成网站www久久九九| 色综合久久综合中文综合网| 亚洲不卡在线观看| 日韩一本二本av| 国产成人在线色| 一区二区三区在线高清| 91精品国产欧美一区二区18| 国产曰批免费观看久久久| 中文字幕亚洲不卡| 欧美精品久久天天躁| 蜜臂av日日欢夜夜爽一区| 日本一区二区三区国色天香| 欧美在线观看一二区| 麻豆视频一区二区| 国产日韩欧美不卡在线| 欧洲亚洲国产日韩| 久久精品国产精品亚洲红杏| 中国av一区二区三区| 欧美视频中文一区二区三区在线观看| 日韩成人一区二区| 国产精品久久夜| 欧美一区二视频| 不卡在线观看av| 日韩av中文在线观看| 国产日韩欧美精品综合| 欧美精品丝袜久久久中文字幕| 国产成人一区二区精品非洲| 亚洲成人av中文| 国产丝袜美腿一区二区三区| 日韩毛片精品高清免费| 成人免费黄色在线| 日韩电影在线观看一区| 一区二区中文视频| 91精品国产高清一区二区三区| 波多野结衣视频一区| 久久99久国产精品黄毛片色诱| 中文字幕日韩一区二区| 精品久久久网站| 欧美午夜免费电影| 大胆亚洲人体视频| 美女高潮久久久| 亚洲午夜精品网| 国产精品护士白丝一区av| 日韩精品影音先锋| 欧美三级视频在线观看 | 欧美一区永久视频免费观看| 91浏览器打开| 国产成人在线观看|