📄 downloadimagethread.java
字号:
/*
* @(#)DownloadImageThread.java 1.11 01/08/23
* Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
* @version 1.0, 10/05/2004
* @author 饶荣庆
* @author 余煜辉
*/
/**
*此common包是连网的共有包,为所有连网提供统一的接口
*/
package com.j2me.common;
import java.io.*;
import javax.microedition.lcdui.*;
/*
*此类是为了提高网络下载速度的下载网络图片线程
*/
public class DownloadImageThread extends Thread
{
/*定义要返回的对象*/
private Displayable dis;
private String imageURL;
private boolean isOk;
private Image image;
public DownloadImageThread(String stringURL)// String imageURL, DowloandGuage dowloand, Displayable displayable, Displayable dis,)
{
this.imageURL = stringURL;
}
public void run()
{
try
{
//从网络上获取图象资源
image = ConnectHttp.getJspImage(imageURL);
isOk = true;
}
catch(IOException e)
{
System.out.println(e);
}
catch(NullPointerException e)
{
System.out.println(e);
}
catch(IllegalArgumentException e)
{
System.out.println(e);
}
}
/**
*判断是否下栽完成
*/
public boolean isOk()
{
return isOk;
}
/**
*返回图象
*/
public Image getImage()
{
if (image != null)
{
return image;
}
else
{
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -