标题:求教setActionCommand问题
取消只看楼主
zhanglinkai
Rank: 1
等 级:新手上路
帖 子:87
专家分:0
注 册:2006-11-25
 问题点数:0 回复次数:0 
求教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
旁边输出提示语 请高手指教 谢谢
搜索更多相关主题的帖子: import java new 
2006-12-09 12:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-108331-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.252978 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved