maptile.java.svn-base
来自「利用J2ME编写的手机应用程序。 功能包括显示图片」· SVN-BASE 代码 · 共 108 行
SVN-BASE
108 行
package wFramework;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import org.kxml2.io.KXmlParser;
import test.Main;
public class MapTile implements XMLConnectionListener
{
private int filehandle, x, y, zoomlevel;
private Image image;
private wFramework wf;
private int rr;
private boolean visible;
private Map map;
MapTile(Map map, int filehandle, int x, int y, int zoomlevel, wFramework wf)
{
this.map = map;
this.wf = wf;
setParams(filehandle, x, y, zoomlevel);
}
public void setVisibility(boolean b)
{
visible = b;
}
public boolean isVisible()
{
return visible;
}
public void setParams(int filehandle, int x, int y, int zoomlevel)
{
this.filehandle = filehandle;
this.x = x;
this.y = y;
this.zoomlevel = zoomlevel;
rr = -1;
image = null;
visible = false;
loadImage();
}
public int getRR()
{
return rr;
}
public int getFilehandle()
{
return filehandle;
}
public int getX()
{
return x;
}
public int getY()
{
return y;
}
public int getZoom()
{
return zoomlevel;
}
public void paint(Graphics g, int x, int y)
{
if (image != null)
{
g.drawImage(image, x, y, Graphics.LEFT | Graphics.TOP);
rr++;
}
}
public Image getImage()
{
return image;
}
private void loadImage()
{
String xml = wf.getSession().buildXML("<fileget filehandle='"+String.valueOf(filehandle)+"'/>");
xml = XMLConnection.urlEncode(xml);
XMLConnection c = new XMLConnection(this);
c.getImage(wf.getBaseURL(), xml, null);
}
public void xmlFailure(String error, Object param) {
}
public void xmlImageSuccess(Image image, Object param)
{
this.image = image;
this.rr = 0;
map.notifyNewTile(this);
}
public void xmlSuccess(KXmlParser xml, Object param) throws Exception {
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?