隨筆-57  評論-202  文章-17  trackbacks-0
          最近在弄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 on 2006-04-14 23:41 小米 閱讀(1388) 評論(1)  編輯  收藏 所屬分類: Java

          評論:
          # re: 由JComponent生成BufferedImage 2008-02-01 12:58 | good
          不錯,有空測試  回復  更多評論
            
          主站蜘蛛池模板: 钟祥市| 建昌县| 前郭尔| 云霄县| 玉林市| 科技| 十堰市| 合肥市| 井冈山市| 论坛| 鸡东县| 通州市| 原平市| 怀宁县| 贺州市| 邻水| 彭泽县| 沈阳市| 迭部县| 凌云县| 开鲁县| 库车县| 色达县| 杨浦区| 城市| 临沭县| 乌鲁木齐县| 营山县| 海安县| 雷波县| 壶关县| 恩施市| 吴桥县| 威海市| 淳化县| 长顺县| 宝鸡市| 佛坪县| 呼和浩特市| 中方县| 化州市|