Article View: cn.bbs.comp.lang.java
Article #19387[ButtonListener]���ʸ�����ģ�
From: �����మ��һ���ˡ��չ˺��Լ�
Date: Mon, 05 Jan 2004 13:11
Date: Mon, 05 Jan 2004 13:11
52 lines
2379 bytes
2379 bytes
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonEvent extends JFrame
{
JButton button=new JButton("click me");
JTextArea textArea=new JTextArea(2,20);
Container c;
int clickCount=0;
public ButtonEvent()
{
super("buttonevent java:press test");
c=getContentPane();
c.setLayout(new FlowLayout());
c.add(button);
c.add(textArea);
setSize(300,120);
setVisible(true);
[1;32m button.addActionListener(new ButtonListener());
}
class ButtonListner implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
clickCount++;
textArea.setText(clickCount+"times");
}
}
public static void main(String args[])
{
ButtonEvent app=new ButtonEvent();
app.addWindowListener(new MyWindowListener());
}
}
������ϢΪ
--------------------Configuration: j2sdk1.4.0 <Default>--------------------
D:\program files\Xinox Software\JCreator Pro\MyProjects\Point\ButtonEvent.java:19: cannot resolve symbol
symbol : class ButtonListener
location: class ButtonEvent
button.addActionListener(new ButtonListener());
^
1 error
Process completed.
��ͬһ��Ŀ¼���Ѿ������ļ�MyWindowListener.java
3x
--
һ���Ȼ��ǧ����շ硣
[m[1;35m�� ��Դ:��Ʈ��ˮ�Ƽ� freecity.cnzju.net��[FROM: varush][m
Technical Details
Message-ID:
<4A95Ql$9qJ@freecity.cnzju.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!FreecityShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,GB X-Google-Thread: f6cb0,2695f276b42afe81,start X-Google-Attributes: gidf6cb0,public X-Google-ArrivalTime: 2004-01-05 05:07:24 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newshosting.com!nx02.iad01.newshosting.com!167.206.3.103.MISMATCH!news3.optonline.net!maily.cic.tsinghua.edu.cn!news.ccie.net.cn!Freecity From: varush.bbs@freecity.cnzju.net (�����మ��һ���ˡ��չ˺��Լ�) Newsgroups: cn.bbs.comp.lang.java Subject: [ButtonListener]���ʸ�����ģ� Date: 05 Jan 2004 13:11:47 GMT Organization: Ʈ��ˮ�Ƽ� Message-ID: <4A95Ql$9qJ@freecity.cnzju.net> Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Filename: Java/M.1073308175.A