Article View: cn.bbs.comp.lang.java
Article #13036Re: һ�������е�С���⣬��ѧ����Ц:)
From: ����������������ֽ
Date: Mon, 12 Jul 2004 03:31
Date: Mon, 12 Jul 2004 03:31
84 lines
4374 bytes
4374 bytes
д���ʱ�������Ҫ�Լ������Լ���ʱ����õ�this�ؼ���
�����и����Ա����str1
���һ��������������������ʱ��Ϳ���ʹ��this.str1
"���ֵĴ�" <khadgar.bbs@bbs.nankai.edu.cn> д���ʼ�
news:4DB8DY$AWU@bbs.nankai.edu.cn...
> ����52�е�ButtonTest.this��ΪʲôҪ��ôд��this���ò�������ڶ�����˵����
��
> javadoc��������˵�ģ�
> public static void showMessageDialog(Component parentComponent,
> Object message,
> String title,
> int messageType)
> parentComponent - determines the Frame in which the dialog is displayed;
if
> null, or if the parentComponent has no Frame, a default Frame is used
> ����ط��ܾ�����Щת��������ϣ����ֽ�������һЩ��
> ���⣬����������֮��������.class�ļ���
> ButtonTest.class
> ButtonTest$ButtonHandler.class
> ButtonTest$1.class
> ���һ���Dz���һ�������ڲ��ָࣿ���dz����е��ĸ��ط���
>
> // Fig. 13.10: ButtonTest.java
> // Creating JButtons.
> import java.awt.*;
> import java.awt.event.*;
> import javax.swing.*;
>
> public class ButtonTest extends JFrame {
> private JButton plainButton, fancyButton;
>
> // set up GUI
> public ButtonTest()
> {
> super( "Testing Buttons" );
>
> // get content pane and set its layout
> Container container = getContentPane();
> container.setLayout( new FlowLayout() );
>
> // create buttons
> plainButton = new JButton( "Plain Button" );
> container.add( plainButton );
>
> Icon bug1 = new ImageIcon( "bug1.gif" );
> Icon bug2 = new ImageIcon( "bug2.gif" );
> fancyButton = new JButton( "Fancy Button", bug1 );
> fancyButton.setRolloverIcon( bug2 );
> container.add( fancyButton );
>
> // create an instance of inner class ButtonHandler
> // to use for button event handling
> ButtonHandler handler = new ButtonHandler();
> fancyButton.addActionListener( handler );
> plainButton.addActionListener( handler );
>
> setSize( 275, 100 );
> setVisible( true );
>
> } // end ButtonTest constructor
>
> public static void main( String args[] )
> {
> ButtonTest application = new ButtonTest();
> application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
> }
>
> // inner class for button event handling
> private class ButtonHandler implements ActionListener {
>
> // handle button event
> public void actionPerformed( ActionEvent event )
> {
> JOptionPane.showMessageDialog( ButtonTest.this,
> //???????????????????
> "You pressed: " + event.getActionCommand() );
> }
>
> } // end private inner class ButtonHandler
>
> } // end class ButtonTest
> --
> [m[1;31m�� ��Դ:���Ұ��Ͽ�վ nkbbs.org��[FROM: 10.21.2.74][m
Technical Details
Message-ID:
<cct05n$rla$1@news.yaako.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.cn99.com!news.yaako.com!not-for-mailReferences:
<4DB8DY$AWU@bbs.nankai.edu.cn>Show Full Headers
Complete Article Headers
X-Google-Thread: f6cb0,bb672dec3b19338 X-Google-Attributes: gidf6cb0,public X-Google-Language: Chinese,GB Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed.mesh.ad.jp!newsfeed.media.kyoto-u.ac.jp!newsgate.cuhk.edu.hk!news.cn99.com!news.yaako.com!not-for-mail From: "����������������ֽ" <seawayzlx@163.com> Newsgroups: cn.bbs.comp.lang.java Subject: Re: һ�������е�С���⣬��ѧ����Ц:) Date: Mon, 12 Jul 2004 11:31:26 +0800 Organization: Bentium Ltd. (CN99) Lines: 86 Message-ID: <cct05n$rla$1@news.yaako.com> References: <4DB8DY$AWU@bbs.nankai.edu.cn> NNTP-Posting-Host: 61.134.6.135 X-Trace: news.yaako.com 1089602551 28330 61.134.6.135 (12 Jul 2004 03:22:31 GMT) X-Complaints-To: usenet@news.yaako.com NNTP-Posting-Date: Mon, 12 Jul 2004 03:22:31 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409