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

📄 ex_14.java

📁 JAVA分布式程序学习的课件(全英文)
💻 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 + -