📄 buttonsinframes.java~2~
字号:
package buttonsinframes;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2005</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.awt.*;
class ButtonsInFrames
extends Frame {
int a1 = 0, a2 = 0;
public static void main(String args[]) {
ButtonsInFrames myframe1 = new
ButtonsInFrames();
myframe1.setTitle("Button in Frame1");
myframe1.resize(200, 200);
myframe1.show();
ButtonsInFrames myframe2 = new
ButtonsInFrames();
myframe2.setTitle("Button in Frame2");
myframe2.resize(200, 200);
myframe2.show();
}
ButtonsInFrames() {
setLayout(new BorderLayout());
Button b1 = new Button("Button1");
Button b2 = new Button("Button2");
add("North", b1);
add("South", b2);
}
public boolean handleEvent(Event evt) {
switch (evt.id) {
case Event.WINDOW_DESTROY:
dispose();
return true;
case Event.ACTION_EVENT:
return action(evt, evt.arg);
default:
return super.handleEvent(evt);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -