隨筆-57  評論-202  文章-17  trackbacks-0
            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 小米 閱讀(1391) | 評論 (1)編輯 收藏
          主站蜘蛛池模板: 盖州市| 双辽市| 武安市| 吉木乃县| 大邑县| 偃师市| 前郭尔| 林西县| 西盟| 长乐市| 柳江县| 聂拉木县| 台东县| 塔城市| 阿拉尔市| 遂溪县| 鹰潭市| 图们市| 景谷| 大关县| 修武县| 沈丘县| 永济市| 边坝县| 邳州市| 迁西县| 桂阳县| 安图县| 郓城县| 贺兰县| 来安县| 和静县| 武清区| 岱山县| 马关县| 宾川县| 阿瓦提县| 会昌县| 松江区| 文水县| 温宿县|