exerciseone.java

来自「这是用JAVA做的一个小程序」· Java 代码 · 共 37 行

JAVA
37
字号
/*
 * @(#)Exerciseone.java 1.0 04/06/04
 *
 * 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.*;
import java.awt.event.*;


public class Exerciseone extends Applet implements ActionListener{
	Image image;
	TextField tf;
	String str;
	public void init() {
		tf=new TextField(30);
		add(tf);
		tf.addActionListener(this);
	}

	public void paint(Graphics g) {
		image=getImage(this.getDocumentBase(),str);
		g.drawImage(image,50,60,this);
	}
	public void actionPerformed(ActionEvent ae){
		str=tf.getText();
		repaint();
	}
}

⌨️ 快捷键说明

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