http://community.csdn.net/expert/Topicview2.asp?id=4383710
这是原贴,回答的没个靠边的。
我显示图片的方法
ImageIcon icon = new ImageIcon( "c:/temp/xx.gif ");
jLabelYZ.setIcon(icon);
我这样显示一张图片,怎么只能显示最上面一部分?
怎么才能全部显示?
出现的问题:
更奇怪了,似乎是我自己生成的xx.gif文件才显示不了,别的都没问题。
我生成xx.gif文件的代码:
rsp = conn.Get(path + "x.asp ");
byte[] imageByte = rsp.getData();
File imageFile = new File( "c://temp/sky.gif ");
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(imageFile));
bos.write(imageByte);
bos.close();
bos = null;
是不是保存的格式有问题? 可我看了二进制码,头六个字节和别的gif图片是一样的啊。这个图片生成页面
http://sky.intosf.com/x.asp
现在好像打不开了,如果谁能帮我测试的,留下邮箱我把图片发过去。
这是原贴,回答的没个靠边的。
我显示图片的方法
ImageIcon icon = new ImageIcon( "c:/temp/xx.gif ");
jLabelYZ.setIcon(icon);
我这样显示一张图片,怎么只能显示最上面一部分?
怎么才能全部显示?
出现的问题:
更奇怪了,似乎是我自己生成的xx.gif文件才显示不了,别的都没问题。
我生成xx.gif文件的代码:
rsp = conn.Get(path + "x.asp ");
byte[] imageByte = rsp.getData();
File imageFile = new File( "c://temp/sky.gif ");
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(imageFile));
bos.write(imageByte);
bos.close();
bos = null;
是不是保存的格式有问题? 可我看了二进制码,头六个字节和别的gif图片是一样的啊。这个图片生成页面
http://sky.intosf.com/x.asp
现在好像打不开了,如果谁能帮我测试的,留下邮箱我把图片发过去。
楼主,我想问一下,你有没有读BMP,JPG,JPEG的图片的方法吗?我想要。因为我现在读取图片什么都不能读。
很多类的确可以直接读这两类图形文件
比如上面提到的ImageIcon,不过,从名字上应该明白这个类是专用来干什么的读写一种媒体文件,肯定免不了encode/decode过程,不然的话,压缩比怎么来?!gif的编码解码器在 sun.awt.image
jpg的在 com.sun.image.codec.jpeg
png的在 com.keypoint (非JDK自带,需要下载jcommon,其实也可以自己写)
bmp的在 ???? (这个找微软要?)
更奇怪了,似乎是我自己生成的xx.gif文件才显示不了,别的都没问题。
我生成xx.gif文件的代码:
rsp = conn.Get(path + "x.asp ");
byte[] imageByte = rsp.getData();
File imageFile = new File( "c://temp/sky.gif ");
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(imageFile));
bos.write(imageByte);
bos.close();
bos = null;
是不是保存的格式有问题?--------------------你用FileOutputStream 试试看
getData()函数是这样的public synchronized byte[] getData() throws IOException, ModuleException
{
if (!initialized) handleResponse(); if (Data == null)
{
try
{ readResponseData(inp_stream); }
catch (InterruptedIOException ie) // don't intercept
{ throw ie; }
catch (IOException ioe)
{
Log.write(Log.RESP, "HResp: (\"" + method + " " +
OriginalURI.getPathAndQuery() + "\")");
Log.write(Log.RESP, " ", ioe); try { inp_stream.close(); } catch (Exception e) { }
throw ioe;
} inp_stream.close();
} return Data;
}现在网站开了,能帮我看看吗?
http://sky.intosf.com/x.asp
换个问题
怎么在点击按钮后让光标移动到某个text上?
郁闷,似乎是个描点图片。根本就不是标准的GIF。再问一次这个问题,没人回答就结了。怎么在点击按钮后让光标移动到某个text上?