⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 canvasdemo_gui.java

📁 JAVA程序设计课程中各章节的程序实例。
💻 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 + -