p198.txt

来自「简单的SWING组建的实现」· 文本 代码 · 共 32 行

TXT
32
字号

import java.awt.*;
import javax.swing.*;
public class xx{
        public static void main(String args[]){
       new WindowFlow("FlowLyout hh");  
    }
}
class WindowFlow extends JFrame{
        JButton b[];
        WindowFlow(String s){
        setTitle(s);
        b=new JButton[10];
        FlowLayout flow=new FlowLayout();
        flow.setAlignment(FlowLayout.LEFT);
        flow.setHgap(2);
        flow.setVgap(8);
        setLayout(flow);
        for(int i=0;i<b.length;i++){
        b[i]=new JButton(""+i);
        add(b[i]);
        if(i==b.length-1)
        b[i].setPreferredSize(new Dimension(80,40));
           
} 

          validate();
          setBounds(100,100,200,160);
          setVisible(true);
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
}
} 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?