- import javax.swing.*;
- import java.awt.FlowLayout;
- public class Ch113 {
- private JFrame fm;
- private JButton x[];
- Ch113()
- {
- x=new JButton[]{new JButton("x"),new JButton("xxxxx"),new JButton("xxxxxxxx"),new JButton("xxxxxx xxxxxx"),new JButton("xxx"),new JButton("x")};
- fm=new JFrame("\u34cd\udeff\u0925");
- fm.setLayout(new FlowLayout(5,10,FlowLayout.LEFT));
- fm.setResizable(true);
- fm.setVisible(true);
- fm.setBounds(100,100,500,300);
- fm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- for(JButton i:x)
- fm.add(i);
- }
- public static void main(String[] args)
- {
- new Ch113();
- }
- }
複製代碼 |