0
点赞
收藏
分享

微信扫一扫

FlowLayoutDemo


package com.shrimpking.t6;

import java.awt.*;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : Shrimpking
 * @create 2024/9/23 15:51
 */
//ch18-5
public class FlowLayoutDemo
{
    public static void main(String[] args)
    {
        Frame frame = new Frame();
        frame.setTitle("流式布局");
        //布局方式
        frame.setLayout(new FlowLayout(FlowLayout.LEFT,30,5));
        for (int i = 0; i < 11; i++)
        {
            frame.add(new Button("button" + i));
        }
        frame.pack(); //依据组件的容量设置窗口大小,使之整好容纳
        frame.setVisible(true);
    }
}

举报
0 条评论