标题:如何获得图片的高和宽??
取消只看楼主
无名可用
Rank: 4
等 级:业余侠客
帖 子:79
专家分:259
注 册:2010-7-27
结帖率:100%
已结贴  问题点数:20 回复次数:0 
如何获得图片的高和宽??
我调用img.getWidth(this),单步调试发现返回值是-1。。

以下是代码:
程序代码:

    public MyPanel( String path, int row, int col, int fw, int fh )
    {
        img = this.getToolkit().getImage(path);           /* load picture */          
    
        this.GetUnitSize();    
    }

        private void GetUnitSize()
     {
         this.sw = this.img.getWidth(this) / this.col;
         this.sh = this.img.getHeight(this) / this.row;
         System.out.println( sw + " " + sh );
     }


大家帮帮忙,我都搞了快两小时了,郁闷死了
搜索更多相关主题的帖子: 图片 如何 
2011-12-02 20:38



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-356811-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.769704 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved