package com.test; import java.awt.*; import javax.swing.JButton; import javax.swing.Jframe; import javax.swing.JPanel; public class FlowLayoutTest extends Jframe{ //JPanel默认流式布局管理器FLowLayout JPanel jPanel=new JPanel(new FlowLayout(FlowLayout.LEFT,80,40)); JButton jb1=new JButton("Button 1"); JButton jb2=new JButton("Button 2"); JButton jb3=new JButton("Button 3"); JButton jb4=new JButton("Button 4"); JButton jb5=new JButton("Button 5"); JButton jb6=new JButton("Button 6"); JButton jb7=new JButton("Button 7"); JButton jb8=new JButton("Button 8"); JButton jb9=new JButton("Button 9"); JButton jb0=new JButton("Button 0"); public FlowLayoutTest() { super("流式布局管理器"); Container container=getContentPane(); jPanel.add(jb1); jPanel.add(jb2); jPanel.add(jb3); jPanel.add(jb4); jPanel.add(jb5); jPanel.add(jb6); jPanel.add(jb7); jPanel.add(jb8); jPanel.add(jb9); jPanel.add(jb0); container.add(jPanel); setSize(600, 400); setLocationRelativeTo(null); setDefaultCloseOperation(EXIT_ON_CLOSE); //setResizable(false); setVisible(true); } public static void main(String[] args) { // TODO Auto-generated method stub new FlowLayoutTest(); } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)