首页 > 其他 > 详细

Activator常用方法

时间:2015-08-28 19:30:45      阅读:180      评论:0      收藏:0      [点我收藏+]

1.获取图片

public static Image getImage(String key) {
        Image img = getDefault().getImageRegistry().get(key);
        if (img == null) {
            getDefault().getImageRegistry().put(key,
                    getImageDescriptor(key).createImage());
            img = getDefault().getImageRegistry().get(key);
        }

        return img;
    }

    /**
     * Returns an image descriptor for the image file at the given plug-in
     * relative path
     *
     * @param path
     *            the path
     * @return the image descriptor
     */
    public static ImageDescriptor getImageDescriptor(String path) {
        return imageDescriptorFromPlugin(PLUGIN_ID, path);
    }
    

2.获取颜色
    public static Color getColor(RGB rgb) {
        if (color == null) {
            color = ColorCache.open();
        }
        return color.getColor(rgb);
    }

Activator常用方法

原文:http://www.cnblogs.com/huadoumi/p/4767059.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!