framesprite.java
来自「Sony Ericsson手机上的Facebook客户端全套代码」· Java 代码 · 共 98 行
JAVA
98 行
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3)
// Source File Name: FrameSprite.java
package se.southend.drops.gui;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import se.southend.drops.scene.Sprite;
public class FrameSprite extends Sprite
{
public FrameSprite()
{
}
public FrameSprite(Image frame)
{
setImage(frame);
}
public void setImage(Image frame)
{
this.frame = frame;
wImage = frame.getWidth();
hImage = frame.getHeight();
setRegion(wImage / 2, hImage / 2, wImage - wImage / 2 - 1, hImage - hImage / 2 - 1);
}
public void setSize(int width, int height)
{
this.width = width;
this.height = height;
}
public void setRegion(int leftWidth, int topHeight, int rightWidth, int bottomHeight)
{
wLeft = leftWidth;
hTop = topHeight;
wRight = rightWidth;
hBottom = bottomHeight;
wCenter = wImage - leftWidth - rightWidth;
hCenter = hImage - topHeight - bottomHeight;
}
public int getWidth()
{
return width;
}
public int getHeight()
{
return height;
}
public void paint(Graphics graphics)
{
int xScr = getScreenX();
int yScr = getScreenY();
int left = xScr + wLeft;
int right = (xScr + width) - wRight;
int top = yScr + hTop;
int bottom = (yScr + height) - hBottom;
int xRight = wImage - wRight;
int yBottom = hImage - hBottom;
graphics.drawRegion(frame, 0, 0, wLeft, hTop, 0, xScr, yScr, 20);
for(int x = left; x < right; x += wCenter)
graphics.drawRegion(frame, wLeft, 0, wCenter, hTop, 0, x, yScr, 20);
graphics.drawRegion(frame, xRight, 0, wRight, hTop, 0, right, yScr, 20);
for(int y = top; y < bottom; y += hCenter)
{
graphics.drawRegion(frame, 0, hTop, wLeft, hCenter, 0, xScr, y, 20);
graphics.drawRegion(frame, xRight, hTop, wRight, hCenter, 0, right, y, 20);
}
graphics.drawRegion(frame, 0, yBottom, wLeft, hBottom, 0, xScr, bottom, 20);
for(int x = left; x < right; x += wCenter)
graphics.drawRegion(frame, wLeft, yBottom, wCenter, hBottom, 0, x, bottom, 20);
graphics.drawRegion(frame, xRight, yBottom, wRight, hBottom, 0, right, bottom, 20);
}
private Image frame;
private int wImage;
private int hImage;
private int wLeft;
private int wCenter;
private int wRight;
private int hTop;
private int hCenter;
private int hBottom;
private int width;
private int height;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?