ex_14.java
来自「JAVA分布式程序学习的课件(全英文)」· Java 代码 · 共 40 行
JAVA
40 行
// chap_10\Ex_13.java
// form program
// program to demonstrate an applet which obtains input
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.applet.*;
public class Ex_14 extends Applet implements
ActionListener
{
TextField inputField = new TextField(20);
public void init ( )
{
setBackground ( Color.white);
setForeground ( Color.blue);
// setLayout ( new FlowLayout(FlowLayout.CENTER));
add ( new Label("INPUT"));
add (inputField);
inputField.addActionListener(this);
}// end init( )
public void actionPerformed (ActionEvent event)
{
Font font = new Font("Monospaced", Font.ITALIC, 50);
// capture data
String input = inputField.getText();
Graphics g = getGraphics( );
g.setFont (font);
g.setColor(Color.blue);
g.drawString(input, 75, 100);
} // end actionPerformed
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?