buttonsinframes.java~2~
来自「java2参考大全上的例子的源码和自己的理解.」· JAVA~2~ 代码 · 共 49 行
JAVA~2~
49 行
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 + =
减小字号Ctrl + -
显示快捷键?