日期:2014-05-20  浏览次数:20638 次

我如果想给一个按钮加一个点击时间,要怎么写代码呢?
rt

------解决方案--------------------
Button bu = new Button( "按我 ");
bu.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
System.out.println(((Button)e.getSource()).getLabel());
}



});
------解决方案--------------------
在文本框后面追加文字,不删除原来的文字

StringBuffer textInfo=new StringBuffer(text.getText());
textInfo.append( "想追加的文字 ");
text.setText(textInfo.toString());