📄 containerevent.java
字号:
/******************************************
* class ContainerEvent(version 1.0)
*******************************************/
import java.awt.*;
public class ContainerEvent
{
public static void main(String args[])
{
MyFrame fr = new MyFrame("Container Event Test 1.0");
Button B1 = new Button("Test");
Button B2 = new Button("Exit");
fr.setLayout( new FlowLayout() );
fr.add(B1);
fr.add(B2);
fr.resize(200,200);
fr.show();
}
}
class MyFrame extends Frame
{
MyFrame(String str)
{
super(str);
}
public boolean action(Event e, Object arg)
{
if( arg=="Test")
{
System.out.println("Button Test pressed.");
}
else
{
System.exit(0);
}
return true;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -