
2006年4月14日
最近在弄swing,需要由JComponent生成BufferedImage,在CSDN上發現一個好例子。下面是范例:
Rectangle?rect?=?comp.getBounds();
?BufferedImage?bufImage?=?new?BufferedImage(rect.width,
???????????rect.height,
???????????BufferedImage.TYPE_INT_RGB);
?Graphics?g?=?bufImage.getGraphics();
?g.translate(-rect.x,?-rect.y);
?comp.paint(g);這樣,JComponent中的圖像就保存到BufferedImage中了。
原文的鏈接:
http://dev.csdn.net/article/13/13531.shtm
posted @
2006-04-14 23:41 小米 閱讀(1383) |
評論 (1) |
編輯 收藏
小米,生活在深圳,專注于Java,主要從事數據庫和網頁編程?,F在在學習著Hibernate和Spring。喜歡游戲、音樂和臺球。聯系方式:georgehill@21cn.com
|
|
26 | 27 | 28 | 29 | 30 | 31 | 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 | 1 | 2 | 3 | 4 | 5 | 6 |
常用鏈接
留言簿(27)
隨筆分類
隨筆檔案
文章分類
文章檔案
我的朋友們
我的鏈接
搜索
積分與排名
最新評論

閱讀排行榜
評論排行榜