求解
import java.applet.*;import java.awt.*;
import java.awt.Event.*;
import java.awt.event.ActionEvent;
public class UpperCase extends implements ActionListener
{
Label lblString = new Label ("请输入单词:");
Label lblUpperCase = new Label ("此处显示大写单词:");
TextField txtString = new TextField (4);
Button btnString = new Button ("大写");
public void init()
{
add ( lblString );
add ( txtString );
add ( lblString );
add ( lblUpperCase );
btnString.addActionListener ( this );
}
public void actionPerformed ( ActionEvent e )
{
String s = txtString.getText();
String upperCase = s.toUpperCase();
lblUpperCase.setText( upperCase );
}
}