标签窗体 : 标签面板 « 图形用户界面 « Java

En
Java
1. 图形用户界面
2. 三维图形动画
3. 高级图形
4. 蚂蚁编译
5. Apache类库
6. 统计图
7. 
8. 集合数据结构
9. 数据类型
10. 数据库JDBC
11. 设计模式
12. 开发相关类
13. EJB3
14. 电子邮件
15. 事件
16. 文件输入输出
17. 游戏
18. 泛型
19. GWT
20. Hibernate
21. 本地化
22. J2EE平台
23. 基于J2ME
24. JDK-6
25. JNDI的LDAP
26. JPA
27. JSP技术
28. JSTL
29. 语言基础知识
30. 网络协议
31. PDF格式RTF格式
32. 映射
33. 常规表达式
34. 脚本
35. 安全
36. Servlets
37. Spring
38. Swing组件
39. 图形用户界面
40. SWT-JFace-Eclipse
41. 线程
42. 应用程序
43. Velocity
44. Web服务SOA
45. 可扩展标记语言
Java 教程
Java » 图形用户界面 » 标签面板屏幕截图 
标签窗体
标签窗体


// : c14:TabbedPane1.java
// Demonstrates the Tabbed Pane.
// <applet code=TabbedPane1 width=350 height=200></applet>
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.

import java.awt.BorderLayout;
import java.awt.Container;

import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

public class TabbedPane1 extends JApplet {
  private String[] flavors = "Chocolate""Strawberry",
      "Vanilla Fudge Swirl""Mint Chip""Mocha Almond Fudge",
      "Rum Raisin""Praline Cream""Mud Pie" };

  private JTabbedPane tabs = new JTabbedPane();

  private JTextField txt = new JTextField(20);

  public void init() {
    for (int i = 0; i < flavors.length; i++)
      tabs.addTab(flavors[i]new JButton("Tabbed pane " + i));
    tabs.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        txt.setText("Tab selected: " + tabs.getSelectedIndex());
      }
    });
    Container cp = getContentPane();
    cp.add(BorderLayout.SOUTH, txt);
    cp.add(tabs);
  }

  public static void main(String[] args) {
    run(new TabbedPane1()350200);
  }

  public static void run(JApplet applet, int width, int height) {
    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(applet);
    frame.setSize(width, height);
    applet.init();
    applet.start();
    frame.setVisible(true);
  }
///:~


           
       
Related examples in the same category
1. A demonstration of the tab wrapping property of JTabbedPaneA demonstration of the tab wrapping property of JTabbedPane
2. 快速测试JTabbedPane组件快速测试JTabbedPane组件
3. JTabbedPane类的展示和设置JTabbedPane类的展示和设置
4. TabbedPane样本TabbedPane样本
5. TabbedPane示例2TabbedPane示例2
6. TabbedPane演示TabbedPane演示
7. 屏幕布局JTabbedPane屏幕布局JTabbedPane
8. TabPane演示TabPane演示
9. TabbedPane试验TabbedPane试验
10. Determining When the Selected Tab Changes in a JTabbedPane Container
11. Enable Scrolling Tabs in a JTabbedPane Container
12. Enabling the Selection of a Tab in a JTabbedPane Container Using a Keystroke
13. Setting the Color of a Tab in a JTabbedPane Container
14. Setting the Tool Tip for a Tab in a JTabbedPane Container
15. Enabling and Disabling a Tab in a JTabbedPane Container
16. Setting the Location of the Tabs in a JTabbedPane Container
17. JTabbedPane容器
18. 索引标签
19. 获得第一个标签的图标
20. 通过子组件获取索引标签
21. 在JTabbedPane容器移动标签
22. 删除标签从JTabbedPane容器
23. 添加一个标签
24. 在所有标签后添加一个标签
25. 在所有标签后添加一个带图标的标签
26. Add a tab with a label, icon, and tool tip at the end of all tabs
27. 在第一个标签后插入标签
28. Getting and Setting the Selected Tab in a JTabbedPane Container
29. 创建JTabbedPane容器
30. 在JSplitPane容器设置分隔符的位置
www.java2java.com | Contact Us
Copyright 2010 - 2030 Java Source and Support. All rights reserved.
All other trademarks are property of their respective owners.