📄 canvasdemo_gui.java
字号:
/**
*A simple canvas prigram in GUI
*2004.11.26. xhcprince
*pay mre attention to this program!!!
*/
import java.awt.*;
import java.applet.*;
public class canvasDemo_GUI extends Applet
{
private canvas obj;
public void init()
{
obj = new canvas(200,200);
this.add(obj);
}
}
class canvas extends Canvas
{
protected canvas(int width, int height)
{
super();
this.setSize(width,height);
}
public void paint(Graphics g)
{
int width = this.getBounds().width;
int height = this.getBounds().height;
g.drawLine(0,0,width,height);
g.drawLine(0,height,width,0);
}
}
/*
<applet code = "canvasDemo_GUI.class" width = 600 height = 300>
</applet>
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -