📄 ex_14.java
字号:
// 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -