深入浅出JavaSwing程序设计一书的源代码

源代码在线查看: newframe.java

软件大小: 792 K
上传用户: huanghuanl
关键词: JavaSwing 程序设计 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				import javax.swing.*;
				import javax.swing.border.*;
				import java.awt.*;
				
				
				public class NewFrame extends JInternalFrame {
				  
				    static int Count = 0;
				    static final int offset = 30;
				
				    public NewFrame() {
					super("", true, true, true, true);
				        setTitle("Untitled Document " + (Count++));
				
					JPanel top = new JPanel();
					top.setBorder(new EmptyBorder(10, 10, 10, 10));
					top.setLayout(new BorderLayout());
				
					JTextArea content = new JTextArea( 10, 30 );
					content.setBorder( new EmptyBorder(0,5 ,0, 5) );
					content.setLineWrap(true);
				
					JScrollPane textScroller = new JScrollPane(content, 
										   JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, 
										   JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
					top.add( textScroller, BorderLayout.CENTER);
					
				
					setContentPane(top);
					pack();
					setLocation( offset * Count, offset *Count);
				    }//end of NewFrame()
				}//end of NewFrame class			

相关资源