drawimage.java

来自「insert the image into the java applet」· Java 代码 · 共 30 行

JAVA
30
字号
/*
 * @(#)DrawImage.java 1.0 06/03/05
 *
 * You can modify the template of this file in the
 * directory ..\JCreator\Templates\Template_2\Project_Name.java
 *
 * You can also create your own project template by making a new
 * folder in the directory ..\JCreator\Template\. Use the other
 * templates as examples.
 *
 */

import java.awt.*;
import java.applet.*;


public class DrawImage extends Applet {
	
	Image im;
	public void init() {
		getImage(getCodeBase(),"flower.jpg");
		
	}

	public void paint(Graphics g) {
		//g.drawString("Welcome to Java!!", 50, 60 );
		g.drawImage(im,0,0,this);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?