?? dynamichookuptest.java
字號(hào):
//file: DynamicHookupTest.javaimport javax.swing.*;import java.awt.event.*;public class DynamicHookupTest extends JFrame { DynamicActionAdapter actionAdapter = new DynamicActionAdapter( ); JLabel label = new JLabel( "Ready...", JLabel.CENTER ); int count; public DynamicHookupTest( ) { JButton launchButton = new JButton("Launch!"); getContentPane( ).add( launchButton, "South" ); getContentPane( ).add( label, "Center" ); actionAdapter.hookup(launchButton, this, "launchTheMissiles"); } public void launchTheMissiles( ) { label.setText("Launched: "+ count++ ); } public static void main(String[] args) { JFrame f = new DynamicHookupTest( ); f.addWindowListener(new WindowAdapter( ) { public void windowClosing(WindowEvent we) { System.exit(0); } }); f.setSize(150, 150); f.setVisible( true ); }}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -