?? mapoverlayicon.java.svn-base
字號(hào):
package wFramework;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class MapOverlayIcon extends MapOverlay
{
private Image icon;
public MapOverlayIcon(Map map, Point pos, Object param)
{
super(map, pos, param);
try
{
icon = Image.createImage("/wFramework/images/defaulticon.png");
}
catch (Exception e)
{
System.out.println("Failed to load default icon");
}
}
public void setIcon(Image icon)
{
this.icon = icon;
updateBounds();
}
public Image getIcon()
{
return icon;
}
public void paint(Graphics g)
{
if (icon == null) return;
Point px = map.worldToPixel(pos);
g.drawImage(icon, px.x, px.y, Graphics.HCENTER | Graphics.VCENTER);
}
private void updateBounds()
{
if (icon == null) return;
int w = icon.getWidth();
int h = icon.getHeight();
int x0 = -w / 2;
int y0 = -h / 2;
bounds = new Rect(x0, y0, x0 + w, y0 + w);
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -