📄 flowlayoutdemo.java
字号:
//FlowLayoutDemo.java
import java.awt.*;
import java.awt.event.*;
public class FlowLayoutDemo extends Frame
{
public FlowLayoutDemo()
{
//设置框架窗口的布局管理器为Flowlayout
this.setLayout( new FlowLayout());
//向框架窗口添加8个Button
this.add( new Button("1") );
this.add( new Button("2") );
this.add( new Button("3") );
this.add( new Button("4") );
this.add( new Button("5") );
this.add( new Button("6") );
this.add( new Button("7") );
this.add( new Button("8") );
}
public static void main( String[] args )
{
FlowLayoutDemo frmFlowLayout=new FlowLayoutDemo();
//设置框架窗体的事件监听(关闭窗体事件)
frmFlowLayout.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
});
//显示框架窗体
frmFlowLayout.pack();
frmFlowLayout.show();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -