Jinglin's 國(guó)度
笑漸不聞聲漸悄 多情卻被無情惱
|
首頁(yè)
|
發(fā)新隨筆
|
發(fā)新文章
|
聯(lián)系
|
聚合
|
管理
積累的一些實(shí)用工具類(持續(xù)添加......)
Image圖片資源獲取及釋放工具類,eclipse
開發(fā)避免不了使用大量的圖片資源,
CacheImage
可以幫我們完成這項(xiàng)工作,使用起來相當(dāng)方便。
import
?java.util.HashMap;
import
?java.util.Iterator;
import
?java.util.Map;
import
?org.eclipse.swt.graphics.Image;
import
?org.eclipse.ui.plugin.AbstractUIPlugin;
public
?
class
?CacheImage?
{
?
private
?
final
?Map
<
String,?Image
>
?imageMap?
=
?
new
?HashMap
<
String,?Image
>
();
?
private
?
static
?CacheImage?INSTANCE;
?
private
?CacheImage()?
{
?}
?
//
?單例模式,獲得CacheImage實(shí)例
?
public
?
static
?CacheImage?getINSTANCE()?
{
??
if
?(INSTANCE?
==
?
null
)
???INSTANCE?
=
?
new
?CacheImage();
??
return
?INSTANCE;
?}
?
//
?獲得圖像
?
public
?Image?getImage(String?applicationID,String?imageName)?
{
??
if
?(imageName?
==
?
null
)
???
return
?
null
;
??Image?image?
=
?(Image)?imageMap.get(imageName);
??
if
?(image?
==
?
null
)?
{
???image?
=
AbstractUIPlugin.imageDescriptorFromPlugin(
?????applicationID,imageName).createImage();
???imageMap.put(imageName,?image);
??}
??
return
?image;
?}
?
//
?釋放圖像資源
?
public
?
void
?dispose()?
{
??Iterator?iterator?
=
?imageMap.values().iterator();
??
while
?(iterator.hasNext())
???((Image)?iterator.next()).dispose();
??imageMap.clear();
?}
}
窗口居中工具類
import
?org.eclipse.swt.graphics.Rectangle;
import
?org.eclipse.swt.widgets.Display;
import
?org.eclipse.swt.widgets.Shell;
public
?
class
?CenterUtil?
{
????
public
?
static
?
void
?centerShell(Display?display,Shell?shell)
{
?????????Rectangle?displayBounds?
=
?display.getPrimaryMonitor().getBounds();
?????????Rectangle?shellBounds?
=
?shell.getBounds();
?????????
int
?x?
=
?displayBounds.x?
+
?(displayBounds.width?
-
?shellBounds.width)
>>
1
;
?????????
int
?y?
=
?displayBounds.y?
+
?(displayBounds.height?
-
?shellBounds.height)
>>
1
;
?????????shell.setLocation(x,?y);
?????}
?}
發(fā)表于 2010-03-07 12:42
催月淚(Jaclick)
閱讀(306)
評(píng)論(0)
編輯
收藏
所屬分類:
eclipse RCP / SWT / JFace
新用戶注冊(cè)
刷新評(píng)論列表
只有注冊(cè)用戶
登錄
后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航:
博客園
IT新聞
Chat2DB
C++博客
博問
管理
隨筆:4 文章:0 評(píng)論:1 引用:0
<
2010年3月
>
日
一
二
三
四
五
六
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
9
10
公告
常用鏈接
我的隨筆
我的評(píng)論
我的參與
最新評(píng)論
留言簿
(2)
給我留言
查看公開留言
查看私人留言
隨筆分類
(2)
eclipse RCP / SWT / JFace(1)
(rss)
Win32匯編MASM基礎(chǔ)(1)
(rss)
個(gè)人小記
(rss)
隨筆檔案
(4)
2010年4月 (1)
2010年3月 (2)
2008年6月 (1)
eclipse
treenode
中國(guó)Eclipse社區(qū)
喜來樂哈哈
SWING
azure--swing
SunKing's Blog
win32匯編
AoGo匯編小站
下載小驛站
Iczelion的Win32匯編教程
常去博客
了我欣藝
街機(jī)&KOF
kof.confusticated.com
搜索
最新評(píng)論
1.?re: 處理WM_SIZE消息
評(píng)論內(nèi)容較長(zhǎng),點(diǎn)擊標(biāo)題查看
--KKY
閱讀排行榜
1.?處理WM_SIZE消息(2801)
2.?CPL和MSC程序(601)
3.?積累的一些實(shí)用工具類(持續(xù)添加......)(306)
4.?收集的一些JAVA資源站點(diǎn)(持續(xù)添加......)(211)
評(píng)論排行榜
1.?處理WM_SIZE消息(1)
2.?CPL和MSC程序(0)
3.?收集的一些JAVA資源站點(diǎn)(持續(xù)添加......)(0)
4.?積累的一些實(shí)用工具類(持續(xù)添加......)(0)
Powered by:
博客園
模板提供:
滬江博客
Copyright ©2025 催月淚(Jaclick)
主站蜘蛛池模板:
四虎精品亚洲一区二区三区
|
久久青草91免费观看
|
亚洲天堂免费在线
|
亚洲手机中文字幕
|
免费A级毛片无码无遮挡内射
|
亚洲AV无码精品无码麻豆
|
免费人成在线观看视频高潮
|
伊人亚洲综合青草青草久热
|
男女一进一出抽搐免费视频
|
亚洲人成人网站色www
|
三年在线观看免费观看完整版中文
|
亚洲天堂2017无码中文
|
99re热免费精品视频观看
|
亚洲一卡2卡3卡4卡乱码 在线
|
性生交片免费无码看人
|
亚洲午夜理论片在线观看
|
国产大片91精品免费看3
|
日韩少妇内射免费播放
|
亚洲精品亚洲人成在线观看
|
日本人成在线视频免费播放
|
亚洲精品不卡视频
|
免费无码又爽又刺激高潮
|
免费很黄无遮挡的视频毛片
|
亚洲中文字幕无码专区
|
无码人妻AV免费一区二区三区
|
亚洲免费电影网站
|
国产公开免费人成视频
|
久久国产精品免费
|
久久精品国产亚洲AV高清热
|
女性自慰aⅴ片高清免费
|
九九综合VA免费看
|
亚洲资源在线观看
|
成人午夜视频免费
|
一二三区免费视频
|
亚洲国产夜色在线观看
|
亚洲成人国产精品
|
每天更新的免费av片在线观看
|
亚洲欧美日韩中文二区
|
亚洲色成人网站WWW永久
|
亚洲高清中文字幕免费
|
eeuss免费影院
|