求教setActionCommand问题
为什么setActionCommand()的不到想要的结果,请高手指教.import javax.swing.*;
import java.applet.*;
import java.awt.*;
import java.net.*;
public class window1 extends JFrame{
final String hint1="请输入用户名:";
String hint2="请输入密码:";
public window1(){
super("Snake");
setBounds(300,300,400,200);
JPanel a=new JPanel();
a.setSize(400,100);
a.setLayout(new GridLayout(2,1));
JTextField b=new JTextField(10);
JPasswordField c=new JPasswordField(10);
b.setActionCommand(hint1);
c.setActionCommand(hint2);
a.add(c);
a.add(b);
getContentPane().add(a);
setVisible(true);
}
public static void main(String[] args){
new window1();
}
}
就是想在JTEXTFIELD
旁边输出提示语 请高手指教 谢谢