这是我第一次弄乱 JApplet.. 我试图让这个 JTextField() 正常工作......但无论我做什么,我都无法让它显示在页面上!
import java.awt.*;
import javax.swing.*;
public class Hangman extends JApplet{
private static final long serialVersionUID = -3966472303224962681L;
public void paint(Graphics g){
super.paint(g);
Container c = getContentPane();
JTextField input = new JTextField(20);
c.setBackground(Color.BLACK);
g.setColor(Color.WHITE);
g.setFont(new Font("Arial", Font.BOLD, 30));
g.drawString("Welcome to the Hagman Applet for the Web!", 20, 30);
g.setFont(new Font("Arial", Font.ITALIC, 18));
g.drawString("also available on android.", 20, 50);
c.add(input);
input.getText();
}
}