100个java小例子

源代码在线查看: rigidb1.java

软件大小: 748 K
上传用户: kzdai22
关键词: java 100
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.awt.*;
				import java.awt.event.*;
				import javax.swing.*;
				
				public class RigidB1 {
				     
				    public RigidB1() {
				    
				    	JFrame f = new JFrame();
				    	
				        Container contentPane = f.getContentPane();
				        Box baseBox = Box.createHorizontalBox();
				        contentPane.add(baseBox);
				        baseBox.add(new JButton("A"));  
				        baseBox.add(Box.createRigidArea(new Dimension(50,100)));
				        baseBox.add(new JButton("B"));
				
					    f.setTitle("BoxLayout");
					    f.pack();
				        f.setVisible(true);
				        
				        f.addWindowListener(new WindowAdapter() {
				            public void windowClosing(WindowEvent e) {
				                    System.exit(0);
				            }
				        });
				    }
				
				    public static void main(String args[]) {
				    
				        RigidB1 b = new RigidB1();
				        
				    }
				}
							

相关资源