📄 imagecanvas.java
字号:
package JavaPhoneTeam10;
import java.awt.*;
public class ImageCanvas extends Canvas
{
Toolkit tool;
Image img;
int width;
int height;
/**
* Constructor, Creates new ImageCanvas
*/
public ImageCanvas(String imgString, int w, int h)
{
this.width = w;
this.height = h;
setSize(w, h);
tool = getToolkit();
img = tool.getImage(imgString);
}
/**
* overide super's paint method, draw the specified image on the canvas
*/
public void paint(Graphics g)
{
g.drawImage(img, 0, 0, width, height, this);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -