zoukankan      html  css  js  c++  java
  • 流布局, FlowLayout(FlowLayout.TRAILING)

    package com.company;
    
    import javax.swing.*;
    import java.awt.*;
    
    public class Main extends JFrame {
        Main(){
            setBounds(100,100,300,200);
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            Container c=getContentPane();
            c.setLayout(new FlowLayout(FlowLayout.RIGHT,20,20));//给容器设置流布局
            /*
            FlowLayout.CENTER-----中心对齐;
            FlowLayout.LEADING-----顶对齐;
            FlowLayout.LEFT--------左对齐;
            FlowLayout.RIGHT-------右对齐;
            FlowLayout.TRAILING----排序对齐;
             */
            for (int i=1;i<10;i++){
                c.add(new JButton("按钮"+i));
            }
            setVisible(true);
        }
    
        public static void main(String[] args) {
             new  Main();
    	// write your code here
        }
    }
    

     

  • 相关阅读:
    re模块
    collections模块
    hashlib模块
    序列号模块
    random模块
    sys模块
    OS模块
    工厂模式
    Go语言之直接选择排序
    Go语言之直接插入排序
  • 原文地址:https://www.cnblogs.com/llhhcc/p/10088310.html
Copyright © 2011-2022 走看看