《Java2图形设计卷II:Swing》配套光盘源码

源代码在线查看: test.java

软件大小: 4504 K
上传用户: guigong
关键词: Java2 Swing 图形 光盘
下载地址: 免注册下载 普通下载 VIP

相关代码

				import java.awt.*;
				import java.awt.event.*;
				import javax.swing.*;
				import javax.swing.event.*;
				
				public class Test extends JApplet {
				
					public Test() {
						Container contentPane = getContentPane();
						JTabbedPane tp = new JTabbedPane();
						JPanel panelOne = new JPanel();
						JPanel panelTwo = new JPanel();
				
						tp.add(panelOne, "Panel One");
						tp.addTab("Panel Two", 
									new ImageIcon("document.gif"),
									panelTwo, 
									"tooltip text");
				
						contentPane.setLayout(new BorderLayout());
						contentPane.add(tp);
				
						tp.addChangeListener(new ChangeListener() {
							public void stateChanged(ChangeEvent e) {
								JTabbedPane tabbedPane = 
													(JTabbedPane)e.getSource();
				
								int index = tabbedPane.getSelectedIndex();
								String s = tabbedPane.getTitleAt(index);
				
								showStatus(s + " selected");
							}
						});
					}
				}
							

相关资源