www.pudn.com > JavaMailWithGUI.rar > TabbedPane.java


 
import javax.swing.JTabbedPane; 
 
public class TabbedPane extends JTabbedPane { 
	 
	public ViewPanel recievePanel  = null; 
	public MessagePanel sendPanel  = null; 
	public ConfigPanel configPanel = null; 
 
	/*构造函数*/ 
	public TabbedPane() { 
		super(); 
		 
		initialize();	//初始化函数 
	} 
	/*初始化函数*/ 
	private void initialize() { 
		//创建配置页面 
		this.addTab("Configuration", null, getConfigPanel(), null); 
		//创建发送页面 
		this.addTab("SendMessage", null, getSendPanel(), null); 
		//创建接收页面 
		this.addTab("MailView", null, getRecievePanel(), null); 
		 
		this.setSize(400, 405);	//设置标签页属性 
	} 
	 
	//创建配置页面 
	private MessagePanel getSendPanel() { 
		if(sendPanel == null) { 
			sendPanel = new MessagePanel(); 
		} 
		return sendPanel; 
	} 
	 
	//创建发送页面 
	private ConfigPanel getConfigPanel() { 
		if(configPanel == null) { 
			configPanel = new ConfigPanel(); 
			configPanel.setEnabled(true); 
		} 
		return configPanel; 
	} 
	 
	//创建接收页面 
	private ViewPanel getRecievePanel() { 
		if(recievePanel == null) { 
			recievePanel = new ViewPanel(); 
		} 
		return recievePanel; 
	} 
}