package tbDataModel;
|
import java.awt.Image;
|
import java.net.URL;
|
import javax.swing.ImageIcon;
|
import javax.swing.JLabel;
|
|
public class Map {
|
int x;
|
int y;
|
int x_Pixel;
|
int y_Pixel;
|
Image image;//±³¾°Í¼Æ¬
|
public int getX_Pixel() {
|
return x_Pixel;
|
}
|
public void setX_Pixel(int x_Pixel) {
|
this.x_Pixel = x_Pixel;
|
}
|
public int getY_Pixel() {
|
return y_Pixel;
|
}
|
public void setY_Pixel(int y_Pixel) {
|
this.y_Pixel = y_Pixel;
|
}
|
|
|
public int getX() {
|
return x;
|
}
|
public void setX(int x) {
|
this.x = x;
|
}
|
public int getY() {
|
return y;
|
}
|
public void setY(int y) {
|
this.y = y;
|
}
|
|
|
public JLabel getMapJlabel(String name) {
|
URL resource=this.getClass().getResource(name);//»ñÈ¡µØÍ¼Í¼Æ¬
|
ImageIcon icon=new ImageIcon(resource);
|
//ÉèÖÃiconµÄ´óС
|
icon.setImage(icon.getImage().getScaledInstance(getX_Pixel(), getY_Pixel(),
|
Image.SCALE_DEFAULT));
|
|
JLabel mapLabel=new JLabel(icon,JLabel.LEFT);//´´½¨Ò»¸öµØÍ¼±êÇ©
|
mapLabel.setBounds(getX(), getY(), getX_Pixel(), getY_Pixel());
|
return mapLabel;
|
}
|
|
|
}
|